Where the implicit self is in St80 [was: Fear and loathing of the
"perlification" of Smalltalk]
Klaus D. Witzel
klaus.witzel at cobss.com
Thu Sep 6 06:41:02 UTC 2007
Hi Jason,
on Thu, 06 Sep 2007 06:08:06 +0200, you wrote:
> On 9/5/07, nicolas cellier wrote:
>>
>> I like the idea of the language being more contextual. Mathematical
>> language concision come from such feature. Put in another context, a
>> mathematical expression meaning can change.
>
> I think Smalltalk has already shown it chooses readability over math
> by being one of the few languages that doesn't make you memorize
> evaluation rules for math expressions. And I like this.
>
> Programming is essentially managing complexity, so the simpler you can
> make the language the easier it is to manage the complexity of the
> problem you're solving. And if you can find a way to make this simple
> language concise as well, then you have a winner.
>
> This is why a Linguists is exactly the person you *don't* want
> creating a language: they try to create a language that behaves as
> spoken language. But spoken language is about the most complicated
> thing you will ever learn. It's so complicated that you can still
> learn new "keywords" decades after having "mastered" it. If you learn
> a new language you will find the language you spoke your entire life
> begins to fail you at times. And spoken language is one of the few
> things that you can use for 20+ years, move to another land and speak
> a new language and after some time completely lose your previous
> language.
>
> This is absolutely not something you want to be basing a tool for
> managing complexity on. And context is one of the things makes spoken
> language so incredibly complex and un-masterable (the other is the
> fact that it's a moving target, but context exaggerates this and even
> drives it to some extent). Think about how many misunderstandings you
> personally see happen every day. These come either from context or
> from disagreement on what a word or concept means (this case is also a
> context).
>
> Context is opinion. I have something in my head and instead of
> expressing it I say "it". Unfortunately the person/people I'm talking
> to either has no idea what I mean by "it", or worse they assume I mean
> something else and go forward based on this assumption. People who
> speak the most clear and cause the least misunderstandings avoid as
> much implicit context as they can (interestingly enough, we call this
> "speaking clearly").
>
> I think programming languages should too, since it's so imperative
> that we avoid misunderstandings. If you have ever worked on a big C++
> project, then you know the pain of trying to figure out how functions
> are going to get called. Overloading happens based on type. And
> often the values you are working with fit none of the types defined
> for the operation. So you have to remember what these values will
> implicitly turn into to know what functions will be called. Context.
>
> And despite being "typeless" Perl is even worse in this regard. The
> language is full of implicit contexts and behaviors based on them. I
> wish I could find the article where one of the Perl gurus (Conway I
> believe) was surprised by a Perl context regarding the for keyword
> after having several books out and considered a master of the
> language.
>
> I personally wouldn't want to see Smalltalk get things like the
> implicit self, splitting us further from other Smalltalks and even
> ourselves as we split into the "implicit self" versus "explicit self"
> groups as C++ did, only to decide explicit self was best practices
> after years of fighting about it.
But it has! :) Smalltalk has implicit self, to some extent. Consider that
Smalltalk and Self are at the same language level. Then, whenever you use
nil, true, false, a temp/arg, an iVar or a class/pool/global var, you send
that implicitly to self, in both languages :)
In Smalltalk it's the compiler who knows what the receiver(s) of these
implicit self messages are, it [the compiler :) ] quickly calculates the
intended binding and emits a corresponding bytecode, optimizing away the
costly message send.
Can you see it? :)
In Self the initial non-optimizing compiler doesn't know that quick
binding. But the Self runtime optimizing compiler comes to the very same
result (binding) as Smalltalk's compiler.
It's a matter of view on things :) It'd be easy in Smalltalk to always
send (self nil), (self true), (self iVar), etc :)
FWIW always using explicit self (in a general sense, not only for the
items mentioned above) is not possible in Self, since (implicit self) ~=
(explicit self) holds in many/most cases except at the root of the parent
"hierarchy".
/Klaus
More information about the Squeak-dev
mailing list
|