View · Search · Index
No registered users in community xowiki
in last 10 minutes

[Xotcl] xotcl::nonposArgs

From: Michael Aram <michael_at_aram.at>
Date: Wed, 15 Jul 2015 11:53:27 +0200

Dear XOTcl/NSF community,

in order to contrain the input of certain methods to allow only objects of
a certain type/class, e.g.:

Utility proc get_object_id_from_sourced_guid {
    -sourced_guid:sourced_guid
} { ... }


we have the following code in our code base:

if {[info command ::xotcl::nonposArgs] ne ""} {
  ::xotcl::nonposArgs proc sourced_guid args {
    if {[llength $args] < 2} return
    foreach {name value} $args break
    if {![::xotcl::Object isobject $value]} {error "'$value' is not an
object"}
    if {![$value istype ::foo::bar::SourcedGuid]} {error "'$value' is not
of type SourcedGuid but [$value info class]"}
  }
  ::Serializer exportMethods {
    ::xotcl::nonposArgs proc sourced_guid
  }
}


This works with XOTcl 1.6, but we now see the following warnings when
running the code under NSF:

Warning: nsf: Could not find value checker type=sourced_guid defined on
::nx::methodParameterSlot


What is the correct way to port this to XOTcl 2.0?

Thank you for your help!
Michael