Beginner's Language? 
Author Message
 Beginner's Language?

Quote:


> > In the case of Smalltalk you will need to slightly change that
> > statement: the core system is very tiny, all the functionality is in
> > it's class library. That even goes as far as that the core does not
> > implement control flow, the libraries do. Restricting one to only part
> > of the libraries is wat every programmer does.

> Even then i would not teach students about converting values into
> messages, which are (i think) not implemented in a library, but as
> part of the language itself.

I don't understand what you are getting at. Messaging is indeed part of
the core system but values are not messages, values are objects in a
Smalltalk system and messages return those values. But what do you mean
when you say 'converting values into messages' ? If you are referring to
the need to use messages to get to instance variables I'd say that is a
real good thing, it hides implementation and thus keeps changes in
implementation local.

Quote:
> Perhaps Forth would have been a better example?

Of what?
The Forth ANSI standard is small enough to be grasped by a single person
so there is no need to aim at a restricted set there.
Anyway I prefer Smalltalk above Forth, one of the reasons being that
Smalltalk yields much more readable code. The absence of syntax in Forth
makes it hard to read (mentally parse) code one is not familiar with.
However if I had to program devices with tiny memory I would seriously
consider using Forth.

Reinout
-------



Thu, 23 Oct 2003 09:47:19 GMT  
 Beginner's Language?

Quote:

> I don't understand what you are getting at. Messaging is indeed part of
> the core system but values are not messages, values are objects in a
> Smalltalk system and messages return those values. But what do you mean
> when you say 'converting values into messages' ? If you are referring to
> the need to use messages to get to instance variables I'd say that is a
> real good thing, it hides implementation and thus keeps changes in
> implementation local.

You can have values such as '#doSoemthing' (it's been a -long- time
since i've done Smalltalk, so please forgive if i get the syntax
wrong). You can convert this symbol into a method call to a routine
called 'doSomething'

Quote:
>> Perhaps Forth would have been a better example?
> Of what?

...of what you were attempting to demonstrate; a language which has
extremely simple semantics with no need to subset it for teaching
purposes, and almost everything placed into a library.

Quote:
> The Forth ANSI standard is small enough to be grasped by a single person
> so there is no need to aim at a restricted set there.

This was my point.

Dale



Thu, 23 Oct 2003 11:38:01 GMT  
 Beginner's Language?

Quote:


> > I don't understand what you are getting at. Messaging is indeed part of
> > the core system but values are not messages, values are objects in a
> > Smalltalk system and messages return those values. But what do you mean
> > when you say 'converting values into messages' ? If you are referring to
> > the need to use messages to get to instance variables I'd say that is a
> > real good thing, it hides implementation and thus keeps changes in
> > implementation local.

> You can have values such as '#doSoemthing' (it's been a -long- time
> since i've done Smalltalk, so please forgive if i get the syntax
> wrong). You can convert this symbol into a method call to a routine
> called 'doSomething'

Now I get it, this is indeed a powerful feature with huge potential for
abuse. It's there so the IDE can be written in Smalltalk and it can live
in the same address space as the application. However when an
application makes use of it that's frowned upon by many Smalltalkers,
tools like SmallLint will report it as a 'questionable message send'.

Quote:
> >> Perhaps Forth would have been a better example?

> > Of what?

> ...of what you were attempting to demonstrate; a language which has
> extremely simple semantics with no need to subset it for teaching
> purposes, and almost everything placed into a library.

> > The Forth ANSI standard is small enough to be grasped by a single person
> > so there is no need to aim at a restricted set there.

> This was my point.

OK, the Smalltalk core is _much_ smaller and the presence of a simple
syntax makes it easier to read than Forth though. So I'd say of these
two Smalltalk is the 'better' example.

Cheers!

Reinout
-------



Thu, 23 Oct 2003 12:05:17 GMT  
 Beginner's Language?

Quote:
> > > The Forth ANSI standard is small enough to be grasped by a single
person
> > > so there is no need to aim at a restricted set there.

> > This was my point.

> OK, the Smalltalk core is _much_ smaller and the presence of a simple
> syntax makes it easier to read than Forth though. So I'd say of these
> two Smalltalk is the 'better' example.

Smalltalk core smaller than Forth, surely you jest? Maybe a minimal
Smalltalk is smaller than a full ANS Forth. But Forth is commonly used under
severely constrained circumstances and the base wordset is small.

Regards Dan Andersson



Thu, 23 Oct 2003 18:49:43 GMT  
 Beginner's Language?

Quote:

> > > > The Forth ANSI standard is small enough to be grasped by a single
> person
> > > > so there is no need to aim at a restricted set there.

> > > This was my point.

> > OK, the Smalltalk core is _much_ smaller and the presence of a simple
> > syntax makes it easier to read than Forth though. So I'd say of these
> > two Smalltalk is the 'better' example.

> Smalltalk core smaller than Forth, surely you jest? Maybe a minimal
> Smalltalk is smaller than a full ANS Forth. But Forth is commonly used under
> severely constrained circumstances and the base wordset is small.

> Regards Dan Andersson

I was talking language concepts you need to learn before delving into
the library, not memory footprint.

As I said earlier in this thread I would seriously consider Forth if I
had to work in a tiny environment.

Reinout
-------



Thu, 23 Oct 2003 19:42:54 GMT  
 Beginner's Language?
Since Forth is essentially syntax less (It only has semantics) and only a
few concepts, less than ten I contest and maybe less than five depending on
how you define concepts (Concept == stretchy definition word), I really
don't see that either. One case in point is that it is not uncommon to learn
Forth by writing a new Forth after being taught the concepts, or maybe a
subset like a simple rpn evaluator. And I'm not talking about modifying
existing code but recreating it from machine code and up. That shows
something of the simplicity of it.The number of user created Smalltalks are
few in comparison. Tcl is another case of a few concepts language, but even
though the syntax is really simple it has a steep learning curve since the
syntax is based on inhuman concepts, IMO. But even if Forth is simple and
efficient it has not really taken of in the mainstream, maybe because the
many versions or maybe because there are so many worthy languages out there.
For example the simple object oriented languages Oberon-2 and Eiffel who are
small but not toy languages, or Icon and Unicon with their extremely
expressive syntax and some functional languages like Erlang, Haskell and
Clean. Not to forget the Lisp/Scheme complex with the excellent DrScheme
environment that I cannot recommend enough.

Regards Dan Andersson



Thu, 23 Oct 2003 21:31:09 GMT  
 Beginner's Language?

Quote:
> You can have values such as '#doSoemthing' (it's been a -long- time
> since i've done Smalltalk, so please forgive if i get the syntax
> wrong). You can convert this symbol into a method call to a routine
> called 'doSomething'

Actually that is a library call, called #perform:. Arguably it is no more
part of the language than #ifTrue:. Eg:

    |aSymbol|
    aSymbol:= #message.
    anObject perform: aSymbol.

has the same effect as:

    anObject message.

The equivalent in C++ would be like:

    void (Object::*aPmf)();
    aPmf = &Object::message;
    (anObject->*aPmf)();

which has the same effect as:

    anObject->message();

I agree this stuff need not be taught on the first day. Still, it is a
useful and powerful technique. I suspect a Smalltalk course could include
it earlier than a C++ course. (The syntax alone could make C++ students
run screaming, never mind the type-checking issues.)

The #message notation itself is part of the language; it produces a
Symbol. A Symbol is what Java calls an "interned" String, meaning that
two Symbols with the same value will have the same identity. This means
that comparing Symbols for equality is fast, because we don't have to
look at each of the characters in them like we do with Strings. This
means they are quite commonly used in Smalltalk; often in situations
where C++ would use an enum. They are not just used with #perform:.

Although this is fairly subtle stuff, I would hope a Smalltalk course
would cover the difference between:

     string1 == string2.
     string1 = string2.

just as a C++ course would cover the difference between:

     string1 == string2;
     strcmp( string1, string2 );

because a programmer who doesn't grasp this does not yet grasp the object
model.

Finally, in Smalltalk we can construct Symbols on the fly. Eg:

    |aPrefix aSuffix aSymbol|
    aPrefix := 'mess'.
    aSuffix := 'age'.
    aSymbol := (aPrefix, aSuffix) asSymbol.
    anObject perform: aSymbol.

I hope it is clear what that is doing. There is no C++ equivalent.

  Dave Harris, Nottingham, UK | "Weave a circle round him thrice,

                              |  For he on honey dew hath fed
 http://www.bhresearch.co.uk/ |   And drunk the milk of Paradise."



Fri, 24 Oct 2003 04:17:00 GMT  
 
 [ 7 post ] 

 Relevant Pages 

1. Beginner's Language?

2. Beginner's Language?

3. Beginner's Language?

4. Beginner's Language?

5. Beginner's Language?

6. Beginner's Language?

7. Beginner's Language?

8. Beginner's Language?

9. Beginner's Language?

10. Beginner's Language?

11. Beginner's 'enum' question

12. beginner: the 'out' instruction

 

 
Powered by phpBB® Forum Software