[prev in list] [next in list] [prev in thread] [next in thread] 

List:       e-lang
Subject:    Re: [E-Lang] E bug?
From:       steve jenson <stevej () sieve ! net>
Date:       2001-10-20 18:06:11
[Download RAW message or body]

Quoting Mark S. Miller (markm@caplet.com):

> The code in Walnut corresponding to your last line above is
> 
>     def sportsCar := carMaker new("Ferrari")
> 
> so try 
> 
>     ? def steveCar := carMaker new("StevesCar")
> 
> As it says later in Walnut, in the section 'Multiple Constructors and "Static Methods" ':
> 
>     Under the covers, the passage "class carMaker(name) :any {...}" is 
>     really a shorthand for defining a carMaker object with the single method 
>     "new(name)".
> 
> Actually, this is oversimplified, but is the right was to think about it for 
> all purposes other than inheritance.  The actual expansion of "class" is 
> given at http://www.erights.org/elang/blocks/inheritance.html .  But if no 
> one calls carMaker's 'adopt' method, and if carMaker never uses the variable 
> 'self' then this expansion is equivalent to the following fable:
> 
>     class carMaker(args...) :guard {
>         ...
>     }
> 
> can usually be thought to simply expand to
> 
>     def carMaker {
>         to new(args...) :guard {
>             ...
>         }
>     }


aha! There was the cause my confusion, no explicit new() method in
my code. I've been away from E long enough now that certain newbie
mistakes are popping up in my code, like this and also thinking that
I can create stateful objects without using the Maker pattern. It
seemed perfectly intuitive to me since I don't need one object to create
another in any other language I'm used to merely because the created
object will have state. Don't take this as a criticism of the Maker
pattern itself but perhaps it might provide insight as to why some new
programmers might find E a bit confusing.



Thank you for the quick answer,
steve

-- 
steve jenson <stevej@sieve.net> http://sieve.net/
PGP fingerprint: 79D0 4836 11E4 A43A 0179  FC97 3AE2 008E 1E57 6138
_______________________________________________
e-lang mailing list
e-lang@mail.eros-os.org
http://www.eros-os.org/mailman/listinfo/e-lang

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic