# Copyright 2006-2007 Kevin Reid, under the terms of the MIT X license # found at http://www.opensource.org/licenses/mit-license.html ................ pragma.syntax("0.9") def sugarRoot implements DeepFrozen, ExitViaHere { match [=="instance___getAllegedType", [_]] { # __getAllegedType/0 for the sugar null.__getAllegedType() } match [=="instance___respondsTo", [self, verb, arity]] { [verb, arity] == ["__getAllegedType", 0] || [verb, arity] == ["__respondsTo", 2] } match [`instance_@verb`, [self] + args] { # XXX typed exception # XXX have built-in no-such-method give this more useful error # this form disabled because simple__quasiParser is too unprimitive #throw(`the ${self.__getAllegedType().getFQName()} ${E.toQuote(self)} does not understand $verb/${args.size()} $args`) throw(E.toString(def _{to __printOn(out :TextWriter) { out.write("the ") out.print(self.__getAllegedType().getFQName()) out.write(" ") out.quote(self) out.write(" does not understand ") out.print(verb) out.write("/") out.print(args.size()) args.printOn(" (", ", ", ")", out) }})) } }