[Xotcl] Scripted Value Constraints

Maksym Zinchenko siqsuruq at gmail.com
Thu Jan 12 15:31:43 CET 2023


Hello, I have a question about Scripted Value Constraints.

I want to create new type check for UUID value, like this:

::nx::Slot method name=uuid {name value} {
if {[regexp
{([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})}
$value] != 1} {
error "Value '$value' of parameter $name is not UUID"
}
}

So the tutorial states:
If the same checks are used in many places in the program, defining names
for the value checker will be the better choice since it improves
maintainability.

This part is kinda blurry for me, what does it means define a name?
For example, how can I use for example:

nx::Class create myClass -superclass mySupaClass {
:property {user:uuid,required}
:property {client:object,required}
:property {total 0}

bla bla bla


Thank you


More information about the Xotcl mailing list