The syntax of Tcl is often criticized as being "strange", which is not
fair in my opinion.
But I understand that programmers coming from other languages do not
catch the syntax very fast... as it was my case, too :-(.
Could we help those beginners by writing a converter from a Lisp-like
syntax to regular Tcl syntax?
I am really willing to help those who do not catch the spirit of Tcl
and give them the opportunity to learn softly our favorite scripting
language.
Regards
Stephane
I suspect most programmers, even CS grads, find Lisp-like syntax a little
(or a lot) strange.
Most would be more comfortable with an Algol-like descended language syntax
(eg Java/C/C#/VB).
That being said -- have fun with the converter!
--
+------------------------------------------------------------------------+
| Gerald W. Lester |
|"The man who fights for his ideals is the man who is alive." - Cervantes|
+------------------------------------------------------------------------+
Tcl and LISP actually have very similar syntax -- both are prefix
languages (except Tcl 'cheats' -- the expr syntax is infix, just like
C).
Both Tcl and LISP treat data and code the same. Data can be code and
code can be data (in Tcl, 'everything is a string', in LISP 'everything
is a list').
Someone who is used to LISP's idiosyncrasies, should be pretty much
at home with Tcl, more so that someone from the 'Algol'
(Pascal/C/C++/Java/JavaScript/C#) or FORTRAN (BASIC) worlds.
>
> Regards
> Stephane
>
--
Robert Heller -- 978-544-6933
Deepwoods Software -- Download the Model Railroad System
http://www.deepsoft.com/ -- Binaries for Linux and MS-Windows
hel...@deepsoft.com -- http://www.deepsoft.com/ModelRailroadSystem/
I wish I remembered what I found strange about Tcl's syntax ... Or
even
if I did find it strange (coming from an Algol/Fortran/C background -
in that chronological order).
What I do find strange is that Tcl is critized for its syntax. Apart
from
the absence of an assignment a la x = y, that may be seen as strange
(but that
is a semantical difference rather than a syntactical one - and
actually
goes very deep, an altogether different topic), what is strange?
Compare:
puts [lindex $list 0]
and
printf( "%s\n", list[0] );
Or the C++ "equivalent":
cout << list.get(0);
To help newcomers with Tcl's perceived strange syntax, we need to know
what they find strange.
Regards,
Arjen
With 8.5, there's a prefix syntax for arithmetic (functions in
the ::tcl::mathfunc namespace, operators in the ::tcl::mathop
namespace) if you prefer; they make some things much easier. And
there's no reason in principle why Lisp couldn't use a special form
for arithmetic expressions; the Lisp world just chooses not to.
> Both Tcl and LISP treat data and code the same. Data can be code and
> code can be data (in Tcl, 'everything is a string', in LISP 'everything
> is a list').
Everything is a list or an atom. Common Lisp also has arrays, which,
while simulatable with lists, are hard to replicate the performance
characteristics of
with classic Lisp; computers are very good at doing arrays...
Which is a bit off-topic for c.l.t I suppose. ;-)
Donal.
That is a great idea! Lisp and TCL share a lot. While Lisp (and especially
Common Lisp) has a lot of extra features like arrays and streams, TCL has TK.
I really would like to try that.
> TCL has TK.
Ah but so does common lisp: http://github.com/cddr/celtk/tree/master
:-)
Tcl syntax is considered strange but
(? (considered (not (strange lisp))))
I don't get it _sigh_
Looks like correct Lisp to me ... but that probably means I do not get
it either.
Or perhaps this:
- Lisp is a demigod among programming languages and is beyond
criticism.
- Tcl is a pariah because mr. Stallman says it should not be used.
The somewhat bizarre social processes among programmers of all sorts
cause
the (ir)rational arguments of the past to flourish without
reconsideration.
Strange, very strange, as the programmers' community has a very
strong
tendency not to be interested in its own history and the achievements
of
the past ...
Regards,
Arjen (being a trifle cynical perhaps - but then it is a monday
morning)