Пример #1
0
        public UserClass(string className, string parentClassName)
        {
            this.className       = className;
            this.parentClassName = parentClassName;

            parentClass = maybe(this.parentClassName.IsNotEmpty(), () => Module.Global.Class(parentClassName)).Map(bc => (UserClass)bc);
            signatures  = new Set <Selector>();
            metaObject  = none <UserObject>();
            mixins      = new SelectorHash <UserClass>();
        }
Пример #2
0
 public BaseClass()
 {
     messages           = new SelectorHash <Func <IObject, Message, IObject> >();
     classMessages      = new SelectorHash <Func <BaseClass, Message, IObject> >();
     registered         = false;
     classRegistered    = false;
     alternateMessages  = new SelectorSet();
     dynamicInvoke      = (obj, _) => throw messageNotFound(classOf(obj), _.Selector);
     classDynamicInvoke = _ => throw messageNotFound(this, _.Selector);
     classFields        = new Fields();
 }
Пример #3
0
        protected IObject invokeClassMessage(Message message)
        {
            var selector = message.Selector;

            if (ClassRespondsTo(selector))
            {
                return(classMessages.ContainsKey(selector) ? classMessages[selector](this, message) : ClassDynamicInvoke(message));
            }
            else
            {
                throw messageNotFound(this, selector);
            }
        }
Пример #4
0
        protected IObject invokeMessage(IObject obj, Message message)
        {
            var selector = message.Selector;

            if (RespondsTo(selector))
            {
                return(messages.ContainsKey(selector) ? messages[selector](obj, message) : DynamicInvoke(obj, message));
            }
            else
            {
                throw messageNotFound(classOf(obj), selector);
            }
        }