Re: Call by Reference



On Oct 21, 1:06 am, Andreas Leitgeb <a...@xxxxxxxxxxxxxxxxxxxxxxxx>
wrote:
tom.rmadilo <tom.rmad...@xxxxxxxxx> wrote:
This point may sound esoteric, but the underlying principle should be
familiar. Which is better: a hand-operated drill, an electric drill,
or a drill press?

My suggestion is about creasing the handoperated drill that we have
for easier drive.

So the idea didn't sink in? We already have exactly what you want in
Tcl. You are confusing Tcl with other languages, and you are focusing
on something you see as a problem without understanding how Tcl has
solved this issue. Worse is it that your solution completely changes
the clean syntax. Whenever you start referencing how other languages
do xyz, just remember: Tcl isn't those other languages, thank goodness
for that.

Here is the basic concept: don't encode information into variable
names or any names in Tcl. Don't encode type information, don't encode
things that you think exist in Tcl (which don't). Strings don't become
variable names until they are used as variable names

You may think this is off base, but consider several commands: lappend
and linsert. Lappend take the name of a list, but linsert takes the
actual list. Your suggestion would be that lappend would change so
that you would do [lappend &mylist a b c]. Otherwise you have a major
distinction between pass by ref and by name. Then we could move on to
the array functions [array get &myarray]. Wow, that looks so cool. If
you don't require this, then you have two different ways of writing
commands. Or maybe you think there should be a difference between
procs (defined by proc) and commands? I don't.

You might try looking at namespaces if you don't like upvar. It is
just like a named stack/level. And it maintains state for you.

Also, there are no *small* syntax changes. You are doubling the number
of ways to pass information.

.



Relevant Pages

  • Re: Call by Reference
    ... that you would do [lappend &mylist a b c]. ... No, this *is not* my suggestion, and I really wouldn't ... would never suggest for tcl. ... for hecl, but would be bad for tcl :-) ...
    (comp.lang.tcl)
  • Printing Issue - TclPro vs ActiveState
    ... I am running ACTIVESTATE TCL 8.4.13 on WINDOWS XP OS computer. ... # Use the GDI package to do direct drawing in windows ... lappend result "Can't get default printer. ...
    (comp.lang.tcl)
  • line numbers in error messages
    ... I've always found it difficult relating tcl error messages to what is ... lappend a "a" \ ... start counting from 0 or 1?). ... I have not yet found an editor that would count lines this way, ...
    (comp.lang.tcl)
  • Re: Best Practice for 1pocket
    ... I dan't remember exactly what my original suggestion for this drill was, but I think it was something like throwing out the 1-5 and shooting them in numerical order, the progressive part of my version being to start with them progressively more up table to make it more interesting. ... I start with the cue ball in hand anywhere on the table; this shifts the emphasis away from making a difficult first shot and more towards the runout pattern, which is what I need to work on in one-pocket. ...
    (rec.sport.billiard)
  • Re: Data structure run-time in tcl...
    ... lappend myMasterArray$val ... and just ignore potential nonrelevant assignments in the array? ... The thing to keep in mind is that tcl is not perl (or python ... ...
    (comp.lang.tcl)