Scripting syntax: all expressions or declarations?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
21 messages Options
12
Reply | Threaded
Open this post in threaded view
|

Scripting syntax: all expressions or declarations?

Damien Pollet
Hi,

We were discussing options to adapt the smalltalk syntax to write code
in files. The main problem is that methods in smalltalk are parsed
separately, and the method patterns won't fit if we are to put several
method declarations in a single file.

- Stef prefers a dedicated declarative syntax (like the one of Pepsi,
and that would indeed be nice to be compatible and not invent yet
another nearly identical syntax)
- I'm more fond of an "everything is an expression" syntax, so a
source file would just be a big doIt in regular syntax with messages
like #subclass:instanceVariables: or #>> and probably a extended block
syntax to give them selectors.

Do you know any discussions about this part of language design? I like
the all-expression way because it feels more interactive, but we will
probably need to abuse the smalltalk syntax to make it really
practical/concise...

--
 Damien Pollet
 type less, do more

Reply | Threaded
Open this post in threaded view
|

Re: Scripting syntax: all expressions or declarations?

Damien Pollet
On 8/23/06, Damien Pollet <[hidden email]> wrote:
> Do you know any discussions about this part of language design?

Put another way, do we want the script syntax to be a format, i.e. a
serialized form of a program, similar to what is in a browser, or do
we want it to be a program (thus user-extensible).

Personally I think I'd hate it if I had to write down all accessors
explicitly. I'd prefer to write
MyClass attrReaders: #(x y)
just like I can use the RB in a standard smalltalk setup.

--
 Damien Pollet
 type less, do more

Reply | Threaded
Open this post in threaded view
|

Re: Scripting syntax: all expressions or declarations?

Klaus D. Witzel
In reply to this post by Damien Pollet
On Wed, 23 Aug 2006 12:46:38 +0200, Damien Pollet wrote:

> Hi,
>
> We were discussing options to adapt the smalltalk syntax to write code
> in files. The main problem is that methods in smalltalk are parsed
> separately, and the method patterns won't fit if we are to put several
> method declarations in a single file.
>
> - Stef prefers a dedicated declarative syntax (like the one of Pepsi,
> and that would indeed be nice to be compatible and not invent yet
> another nearly identical syntax)
> - I'm more fond of an "everything is an expression" syntax, so a
> source file would just be a big doIt in regular syntax with messages
> like #subclass:instanceVariables: or #>> and probably a extended block
> syntax to give them selectors.

For mee too (everything is an expression, big doIt in regular sytnax). I'm  
toying with Self's slot declaration syntax (as an addition to the regular  
Smalltalk syntax), like in

an anonymous class is declared ( | instVar1. ... | )

a method is declared ( | instVar1. selector = ... | )

a method with arguments is then ( | ... keyword: arg = ... | )

And similiar for blocks. Very light, very easy, just add a pair of  
parentheses around regular Smalltalk syntax.

/Klaus

> Do you know any discussions about this part of language design? I like
> the all-expression way because it feels more interactive, but we will
> probably need to abuse the smalltalk syntax to make it really
> practical/concise...
>



Reply | Threaded
Open this post in threaded view
|

Re: Scripting syntax: all expressions or declarations?

timrowledge
I'm not sure I understand this obsession with syntax for scripting.  
Why on earth does it need to be human readable?

We have quite good tools for writing Smalltalk.
We can store the appropriate script/package/incantation in some form.
We can read it into a 'script runner' image.
Done.

Who cares if it looks like
System addMethodNamed:'raspberryTea' toClass:'Fooble' withContents:'^42'
or
abd45be89f20d0562dacf
  when examined in a text editor? Text editors are *so* last century.

tim
--
tim Rowledge; [hidden email]; http://www.rowledge.org/tim
...now touch these wires to your tongue!



Reply | Threaded
Open this post in threaded view
|

Re: Re: Scripting syntax: all expressions or declarations?

Damien Pollet
On 8/23/06, tim Rowledge <[hidden email]> wrote:
> Why on earth does it need to be human readable?

Hmm, because we're humans?

> We can read it into a 'script runner' image.

How do you run a particular script from command line or another script
in bash/ruby/perl ?

>   when examined in a text editor? Text editors are *so* last century.

Isn't Smalltalk older than emacs?

And text editors are still the main tool among non-smalltalkers.
Smalltalk scripting is about hiding the image aspect of Smalltalk: one
weird thing less to get used to in the short term should ease the
transition from traditional languages.

--
 Damien Pollet
 type less, do more

Reply | Threaded
Open this post in threaded view
|

Re: Scripting syntax: all expressions or declarations?

Markus Gälli-3
In reply to this post by timrowledge

On Aug 23, 2006, at 5:36 PM, tim Rowledge wrote:

> I'm not sure I understand this obsession with syntax for scripting.  
> Why on earth does it need to be human readable?
>
> We have quite good tools for writing Smalltalk.
> We can store the appropriate script/package/incantation in some form.
> We can read it into a 'script runner' image.
> Done.
>
> Who cares if it looks like
> System addMethodNamed:'raspberryTea' toClass:'Fooble'  
> withContents:'^42'
> or
> abd45be89f20d0562dacf
>  when examined in a text editor? Text editors are *so* last century.

Do we want to attract the people of the last century to Squeak?

"Marthin Luther was one of the first great User Interface Designers.  
He said: 'The first thing I have to do in user interface design is to  
start with where the user is.'"
   Alan Kay in http://interactive.colum.edu/partners/squeakfest/2005/ 
mp3/AlanKay_SqueakFest05_part5_of_6_reasoning_thinking.mp3

- Looking at the license situation right now, hoping for a pre-
installed fully fledged morphic Squeak on Apples etc. is futile
- If we have a Squeak VM and small headless image installed per  
default on the next versions of OS-X / Suse / Ubuntu / $100 laptop  
etc, we grab more of those old-fashioned "script-kiddies" - if they  
can somehow understand the Squeak-Skripts in their emacs / vims etc.
- Having more visibility for Squeak
        - increases the chances for us to at least join the competition for  
a better Etoys
        - helps us Squeaker in the job market /  Academia
- Besides it would force us to come up with a more decent packaging  
system

Markus
--
...cetero censeo that the current Squeak VM's should be relicensed to  
APSL2.


Reply | Threaded
Open this post in threaded view
|

Re: Scripting syntax: all expressions or declarations?

timrowledge
In reply to this post by Damien Pollet

On 23-Aug-06, at 8:57 AM, Damien Pollet wrote:

> On 8/23/06, tim Rowledge <[hidden email]> wrote:
>> Why on earth does it need to be human readable?
>
> Hmm, because we're humans?

Well, we can cure you with time and patience.
>
>> We can read it into a 'script runner' image.
>
> How do you run a particular script from command line or another script
> in bash/ruby/perl ?

Exactly the same as any other system. The script would executable,  
would invoke the appropriate interpreter (just like perl) which would  
start up, load the appropriate image and then the script. We can do  
that already - since about 97 or so?
>
>>   when examined in a text editor? Text editors are *so* last century.
>
> Isn't Smalltalk older than emacs?
Probably, but I wouldn't hold emacs up as a good example of anything.  
And it certainly wasn't the first text editor, obviously.

>
> And text editors are still the main tool among non-smalltalkers.
> Smalltalk scripting is about hiding the image aspect of Smalltalk: one
> weird thing less to get used to in the short term should ease the
> transition from traditional languages.
I'm not sure I *want* to 'ease the transition from traditional  
languages'. There is a major semantic jump from boring old procedural  
stuff to real objects and dumb tricks like trying to make an OOP with  
C syntax is just foolish. It obfuscates the important changes you  
need to make in your mind. Even plain old '3+4' is just not the same.

I suggest a more applescript/automator approach where possible.  
Decent tool to create the scripts, decent tool to try and debug, etc  
etc.

tim
--
tim Rowledge; [hidden email]; http://www.rowledge.org/tim
Strange OpCodes: PDH: Page to Disk for the Hell of it



Reply | Threaded
Open this post in threaded view
|

Re: Scripting syntax: all expressions or declarations?

Hilaire Fernandes-3
In reply to this post by Damien Pollet
Damien Pollet a écrit :

> On 8/23/06, tim Rowledge <[hidden email]> wrote:
>> Why on earth does it need to be human readable?
>
> Hmm, because we're humans?
>
>> We can read it into a 'script runner' image.
>
> How do you run a particular script from command line or another script
> in bash/ruby/perl ?
>
>>   when examined in a text editor? Text editors are *so* last century.
>
> Isn't Smalltalk older than emacs?
>
> And text editors are still the main tool among non-smalltalkers.
> Smalltalk scripting is about hiding the image aspect of Smalltalk: one
> weird thing less to get used to in the short term should ease the
> transition from traditional languages.


In one hand I really understand Tim position:
what does it mean to edit Smalltalk code in a flat text file?
Is it still Smalltalk as it is done outside of the Smalltalk IDE?
(which may explain why GNU-Smalltalk is so unsuccessfull...)

In the other hand, may be for small script it is deable to write
smalltalk code in flat file (yes, sure, it is doeable, but who want?)

Nevertheless, doing scripting with Smalltalk is really appealing.

Hilaire


Reply | Threaded
Open this post in threaded view
|

Re: Scripting syntax: all expressions or declarations?

Hilaire Fernandes-3
In reply to this post by Markus Gälli-3
Markus Gaelli a écrit :
> --
> ...cetero censeo that the current Squeak VM's should be relicensed to
> APSL2.

Is it not already done ;-)



Reply | Threaded
Open this post in threaded view
|

Re: Scripting syntax: all expressions or declarations?

stéphane ducasse-2
In reply to this post by timrowledge
tim

you cannot think that people want to write in chunk format.
look at pepsi, ian found a nice syntax.

Stef

On 23 août 06, at 17:36, tim Rowledge wrote:

> I'm not sure I understand this obsession with syntax for scripting.  
> Why on earth does it need to be human readable?
>
> We have quite good tools for writing Smalltalk.
> We can store the appropriate script/package/incantation in some form.
> We can read it into a 'script runner' image.
> Done.
>
> Who cares if it looks like
> System addMethodNamed:'raspberryTea' toClass:'Fooble'  
> withContents:'^42'
> or
> abd45be89f20d0562dacf
>  when examined in a text editor? Text editors are *so* last century.
>
> tim
> --
> tim Rowledge; [hidden email]; http://www.rowledge.org/tim
> ...now touch these wires to your tongue!
>
>
>


Reply | Threaded
Open this post in threaded view
|

Re: Scripting syntax: all expressions or declarations?

stéphane ducasse-2
In reply to this post by Hilaire Fernandes-3
let us talk about a scenario.

I run my script headless and when I do not have X install I can still  
edit my file with vi.
Now I have X installed and I use the powerSqueakImage to debug it.

So people prefer to edit file because with vi they just go 100 times  
faster that all of
us typing with 10 fingers. So if we can find a nice syntax to help  
this people hacking in
Smalltalk then we do not lose anything and we will be less trap in  
our image.

I agree that texteditor seems old fashion. But let us face it the  
image is one of the coolest
abstractions so far, but why the image is not just a cache that we  
could rebuild on demand.
This implies that we got trapped into the image. An image should be  
reproduceable.
I like Gnu smalltalk or S# for that. because you could get an image  
from a list of file and
you could redo that as much as you wanted. This helps making sure  
that you are not doing
dirty/easy things on the back

Stef

Reply | Threaded
Open this post in threaded view
|

Re: Scripting syntax: all expressions or declarations?

timrowledge
In reply to this post by stéphane ducasse-2

On 23-Aug-06, at 1:30 PM, stéphane ducasse wrote:

> tim
>
> you cannot think that people want to write in chunk format.
Well, duh, of course not. I think people want to write in decent  
browsers with proper tool support. Then press a button to save the  
script. I'm pretty sure I didn't imply expecting writers to have  
anything to do with chunk format or indeed any particular form.


tim
--
tim Rowledge; [hidden email]; http://www.rowledge.org/tim
Useful random insult:- His page was intentionally left blank.



Reply | Threaded
Open this post in threaded view
|

human readable? (was: Scripting syntax: all expressions or declarations?)

Jecel Assumpcao Jr
In reply to this post by Damien Pollet
I have argued this with several people before, so feel free to skip this
email if you are tired of hearing me always say the same thing.

Damien Pollet wrote:
> On 8/23/06, tim Rowledge wrote:
> > Why on earth does it need to be human readable?
>
> Hmm, because we're humans?

Exactly! We can decode dots on a display or on paper if a set of
hardware and software modules all do their job but we are helpless to
see bits on magnetic disks or on a CD-ROM, for example. So if we are
being picky it doesn't make sense to ever talk about "human readable"
files. They simply don't exist (at least not since punched cards).

But if we are being reasonable instead of picky we could define as
"human readable" any file that I can read with the help of software and
hardware that I already happen to have on hand and weren't specially
created for this particular file. Of course, this is very much like
defining Philips screws as "human removable" and Torx screws as not due
to the tools that you can reasonably expect a person to have around the
house. Note that this is actually a pretty reasonable definition and was
how Apple was able to get a far lesser percentage of early Mac users to
take their machines apart than was usual at the time.

> > We can read it into a 'script runner' image.
>
> How do you run a particular script from command line or another script
> in bash/ruby/perl ?

As Tim already pointed out, there is no difficulty here.
 
> >   when examined in a text editor? Text editors are *so* last century.
>
> Isn't Smalltalk older than emacs?

A little bit (1972 vs 1975), though the roots of EMACS go way further
back. As I like to claim, going from Linux to SqueakNOS is upgrading
from 1960s technology to 1970s stuff ;-)
 
> And text editors are still the main tool among non-smalltalkers.

True, and normally what they use isn't even as good as what Turbo Pascal
had so long ago.

> Smalltalk scripting is about hiding the image aspect of Smalltalk: one
> weird thing less to get used to in the short term should ease the
> transition from traditional languages.

And there are several non Squeak options - GNU Smalltalk (though this
has the chunk syntax), Little Smalltalk, Idst or Slate. In the
commercial world there is S#, Smalltalk for .NET or Resilient (has a
scripting friendly syntax but is really for embedded applications). But
I understand the desire to have Squeak handle this need since it is like
the Linux of the Smalltalk world. Just like having a neat feature in
Plan 9 doesn't do people much good compared to having it in Linux the
alternative Smalltalks aren't considered real options by most people.

My personal opinion about changing this or that about Smalltalk to make
it more acceptable to most people is that this is a futile task. The
reason why the neat Xerox PARC technology failed to make it out to the
world was that the Xerox executives responsible for the necessary
decisions didn't type themselves and didn't see the point in what had
been created. So when new people came along in their very early 20s
(Bill Gates, Steve Jobs) things finally changed. And then the older guys
retired and people no longer even remember how hard it was to get what
we now have.

Sure you might get some Ruby guys to switch with a scripting syntax,
some company to adopt Squeak if there are native widgets, and so on. But
I think it is easier to replace programmers than to convert them. Of
course, if the new programers are carefully trained by the old ones then
nothing changes. You need new people coming in from the outside:

http://paulgraham.com/marginal.html

-- Jecel

Reply | Threaded
Open this post in threaded view
|

Re: Re: Scripting syntax: all expressions or declarations?

Damien Pollet
In reply to this post by Hilaire Fernandes-3
On 8/23/06, Hilaire Fernandes <[hidden email]> wrote:
> In one hand I really understand Tim position:
> what does it mean to edit Smalltalk code in a flat text file?
> Is it still Smalltalk as it is done outside of the Smalltalk IDE?

That's kind my point... the chunk syntax is not really practical
compared to sth like ruby. Probably just because it's unclear what the
! means (is it a separator for method declarations and an delimiter
for methodsFor: directives ?

> (which may explain why GNU-Smalltalk is so unsuccessfull...)

there are so many things that could explain (un)success... why is ruby
successful ?

> Nevertheless, doing scripting with Smalltalk is really appealing.

How do you do it currently ?

(heh, seems I like rhetorical questions :)
--
 Damien Pollet
 type less, do more

Reply | Threaded
Open this post in threaded view
|

Re: Re: Scripting syntax: all expressions or declarations?

Damien Pollet
In reply to this post by timrowledge
On 8/23/06, tim Rowledge <[hidden email]> wrote:
> Well, duh, of course not. I think people want to write in decent
> browsers with proper tool support. Then press a button to save the
> script. I'm pretty sure I didn't imply expecting writers to have
> anything to do with chunk format or indeed any particular form.

Well, duh, good point. Once people get used to the browser they won't
go back to source files (so for this point a readable syntax is just a
bootstrapping hack?)

[and I really need to trol^Wsay that I didn't get the connexion
between "applescript" and "decent tool"]
--
 Damien Pollet
 type less, do more

Reply | Threaded
Open this post in threaded view
|

Re: Re: Scripting syntax: all expressions or declarations?

Damien Pollet
In reply to this post by stéphane ducasse-2
On 8/23/06, stéphane ducasse <[hidden email]> wrote:
> let us talk about a scenario.

script A has such and such dependancies
script B has some others
...

Do I prepare a big runtime-environment-image with every dependency
needed for scripts to come?
I might like the image persistency for a given script, but if I have
only one image for all scripts this will eventually break. One image
per script duplicates too much (how to keep all dependancies
up-to-date in all images?).
So each script has an environment that should be rebooted from time to
time, but also some private persistent data (spoon imprinting and
instant loading ?)

--
 Damien Pollet
 type less, do more


Reply | Threaded
Open this post in threaded view
|

Re: human readable? (was: Scripting syntax: all expressions or declarations?)

Damien Pollet
In reply to this post by Damien Pollet
On 8/23/06, Jecel Assumpcao Jr <[hidden email]> wrote:
> created for this particular file. Of course, this is very much like
> defining Philips screws as "human removable" and Torx screws as not due
> to the tools that you can reasonably expect a person to have around the
> house.

yes,
philips = text editor, torx = smalltalk browser
and I can't copy-paste a class to discuss it in a mail.

> My personal opinion about changing this or that about Smalltalk to make
> it more acceptable to most people is that this is a futile task.

any task is, to a point :)

> Sure you might get some Ruby guys to switch with a scripting syntax,
> some company to adopt Squeak if there are native widgets, and so on.

Actually I'd appreciate cohererent left/middle/right clicking,
readable fonts and exposé on squeak windows...

--
 Damien Pollet
 type less, do more


Reply | Threaded
Open this post in threaded view
|

Re: Scripting syntax: all expressions or declarations?

Trygve
In reply to this post by stéphane ducasse-2
For an image than can be rebuildt from scratch, see this msg from Les Tyrrell:

http://lists.squeakfoundation.org/pipermail/squeak-dev/1998-December/017688.html

and

Alan Wirfs-Brock. Declarative Model for Smalltalk Programs, a talk given at
the OOPSLA Conference, October 1996.

Alan Wirfs-Brock, Brian Wilkerson. An Overview of Modular Smalltalk in
OOPSLA Conference Proceedings. ACM, September 1988.

Enjoy
--Trygve




At 22:34 23.08.2006, Stef wrote:

>let us talk about a scenario.
>
>I run my script headless and when I do not have X install I can still
>edit my file with vi.
>Now I have X installed and I use the powerSqueakImage to debug it.
>
>So people prefer to edit file because with vi they just go 100 times
>faster that all of
>us typing with 10 fingers. So if we can find a nice syntax to help
>this people hacking in
>Smalltalk then we do not lose anything and we will be less trap in
>our image.
>
>I agree that texteditor seems old fashion. But let us face it the
>image is one of the coolest
>abstractions so far, but why the image is not just a cache that we
>could rebuild on demand.
>This implies that we got trapped into the image. An image should be
>reproduceable.
>I like Gnu smalltalk or S# for that. because you could get an image
>from a list of file and
>you could redo that as much as you wanted. This helps making sure
>that you are not doing
>dirty/easy things on the back
>
>Stef


--

Trygve Reenskaug      mailto: [hidden email]
Morgedalsvn. 5A       http://heim.ifi.uio.no/~trygver
N-0378 Oslo           Tel: (+47) 22 49 57 27
Norway



Reply | Threaded
Open this post in threaded view
|

Re: Scripting syntax: all expressions or declarations?

Markus Gälli-3
In reply to this post by Hilaire Fernandes-3

On Aug 23, 2006, at 8:32 PM, Hilaire Fernandes wrote:

> Markus Gaelli a écrit :
>> --  
>> ...cetero censeo that the current Squeak VM's should be relicensed  
>> to APSL2.
>
> Is it not already done ;-)
>
Hi,

uups? Would be quite happy for any pointers to that. :-)

Thanks,

Markus
Reply | Threaded
Open this post in threaded view
|

Re: Scripting syntax: all expressions or declarations?

Hilaire Fernandes-3
Markus Gaelli a écrit :

>
> On Aug 23, 2006, at 8:32 PM, Hilaire Fernandes wrote:
>
>> Markus Gaelli a écrit :
>>> -- ...cetero censeo that the current Squeak VM's should be relicensed
>>> to APSL2.
>>
>> Is it not already done ;-)
>>
> Hi,
>
> uups? Would be quite happy for any pointers to that. :-)

I was dreaming awaken ;-) (is it correct English?)

But then, the right question is as always who are the copyright owner. I
suspect they are fewer than in the Squeak.image. It is at least a good
start :)
The foundation silent is however very loud again on that hot topic.
Marcus (not Markus, right!) can you send us a few bits of enlightenment?

Hilaire

>
> Thanks,
>
> Markus


12