Tcl Source Code

View Ticket
Login
Ticket UUID: 1092508
Title: Tutorial implies false quoting requirements
Type: Bug Version: obsolete: 8.5a3
Submitter: dgp Created on: 2004-12-29 02:34:19
Subsystem: 75. Tutorial Assigned To: davidw
Priority: 5 Medium Severity:
Status: Closed Last Modified: 2005-01-05 01:37:25
Resolution: None Closed By: davidw
    Closed on: 2005-01-04 14:02:17
Description:
In its earliest lessons and examples,
the tutorial implies quoting requirements
that do not exist.

Page:

http://www.tcl.tk/man/tcl8.5/tutorial/Tcl2.html

includes the example:

    set fruit "Cauliflower"

In the next page, the example includes:

     set Z "Albany"
     
The "..." quoting is legal, but not necessary.
Using this quoting style in the first examples
of Tcl commands strongly suggests the
quoting is necessary. This kind of misimpression
early on can lead to faulty beliefs that "..." quoting
creates a "value", or that {...} quoting creates
a "list".  Better to learn early on (both explicitly
and by implication) that Tcl's syntax rules
determine word boundaries and substitution.
No more; no less.

I believe this quoting style is one
favored by the TclTutor author as
a way to indicate programmer intent
regarding values vs. variable names.
It's a fine coding convention to
introduce later on once the precise
syntax requirements of Tcl are well
established.  I think the early lessons
in the tutorial should make use of
only necessary syntax to avoid any
confusion about what Tcl requires
vs. what some coding convention
recommends.
User Comments: hobbs added on 2005-01-05 01:37:25:
Logged In: YES 
user_id=72656

RE: the web issue, I'm hoping that this gets folded into the
Tcl core docs, so it gets updated with each release, as the
other docs on the web site do.

davidw added on 2005-01-05 01:13:04:
Logged In: YES 
user_id=240

Fixes, bugs and quick comments are fine on the bug tracker.
 Discussion of major changes should be on tcl-core.

Personal email to me is ok too for quick things, I use that
as a sort of bug tracker sometimes:-)

dgp added on 2005-01-05 00:16:24:

File Added - 114469: 1092508.patch

dgp added on 2005-01-05 00:16:23:
Logged In: YES 
user_id=80530

Yes, that example helps.

Attached is a patch of
other changes to that page
for you to consider.

I think I'd also drop the quotes
from the first example on the
following page to get:

  set fruit Cauliflower

Another thing to think about
is more careful use of the
terms "string" and "word".

Do you want comments filed
like this in the Bug Tracker?
Or is some other mechanism better?

dgp added on 2005-01-05 00:13:51:
Logged In: YES 
user_id=80530

that example helps. yes.

Here's a patch with other changes
to that page you might consider.

Something else to think about
is careful use of the terms "string"
and "word" in discussing Tcl syntax.

davidw added on 2005-01-04 23:40:31:
Logged In: YES 
user_id=240

That requires manual intervention by someone with access to
the web server.  It would be nice if there were a cron job
pulling these changes out, but once again, someone with
access to the web site would have to "make it so".  It's all
plain HTML, so if you want, it's also possible to just pull
it out of CVS and view it as a local document.

dgp added on 2005-01-04 23:16:01:
Logged In: YES 
user_id=80530

I don't see the change.  Does something
need to be done to publish the change
on the www.tcl.tk web site?

davidw added on 2005-01-04 21:02:17:
Logged In: YES 
user_id=240

I added an example like this:

puts HelloWorld

in the first chapter, and changed some of the others to not
use quoting.

Have a look and see if you think it's adequate.  I'm going
to go ahead and close the bug, but I'd be happy to add some
more.

davidw added on 2004-12-30 05:53:23:
Logged In: YES 
user_id=240

I usually use quotes for consistency's sake, but you are
indeed correct that people should be shown early on that Tcl
is different this way.... you dont' *need* the quotes if you
don't have any spaces.

hobbs added on 2004-12-29 09:37:46:
Logged In: YES 
user_id=72656

While I agree that quoting should be addressed early on (as
continued use of "" can lead a person into quoting hell by
accident), I should note that I use ""s often where "not
necessary" simply because my editor will color it nicely,
which is appropriate in context.

Attachments: