Symbols and scripting

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Symbols and scripting

Richard Drake
P T Withington wrote:

> One of our developers wondered why no scripting language has adopted
> symbols

It depends on one's definitions of course. Peter explores possible
meanings for 'symbol' and summarizes:

> So, I think what you are mostly
> missing is the shorthand where in lisp you can write
> 
>   'foo
>
> and if the symbol already exists, you get the symbol, and if it
> doesn't it will be created for you.

Note that, unlike Python, Ruby, arguably following Smalltalk as much
as Lisp, has symbols like that. Well, to be precise, like this

:foo
:'foo bar'
:"tricky #{expression}"

(p323 of 'Pickaxe', highly regarded Pragmatic Programmers book
on Ruby, gives the literal options, p631 covers the Symbol class)

And Ruby is normally considered a scripting language, no? Whether
that's a compliment or a slur I'll leave others to decide.

Anyway, I add my vote to such a shorthand (as well as concept) in
JS2 (is that the same as ES4, he asks to make clear his ignorance,
or at least the unfamiliarity of the territory), as well as what Brendan
calls an unpolluted Dictionary class.

I speak as an old Smalltalk programmer who is impressed by the
plan to specify in SML without quite knowing the implications. And
as someone who, like others, would like to see more use of JS/AS
on server as well as client.

I feel in the shallows of language design, particularly the interface
between 'dynamic' and 'strong' typing. But I've been lurking here for
a little while and on this I feel I knows what I like !

Thanks for the openness.

Richard




--
Ruby for laser purity