I propose that we drop "."+space/tab as an indentation character, and instead, 
declare that a simple "!" is an indentation character JUST LIKE space or tab.

This is:
1. Trivial to implement. unread-char goes away, the code is easier to separate, 
etc.
2. It's trivial to explain.
3. It is *REALLY* great for highlighting ranges (better than "."), I think it's 
far better than "." for this purpose.  When dealing with whitespace-killers 
like HTML it's okay, perhaps not as nice-looking as "." but workable.
4. Preserves the advantages of having a non-whitespace indent character.

Details below.

Thoughts?  Comments?  Like it? Hate it? Kindof neutral?

--- David A. Wheeler


Alan Manuel Gloria said:
> Not if the indentation tracking finds a ".", then fails to see a tab
> or space after it. Then it's forced to have 2 characters overhead,
> which the modern-expr reader must read back to find the symbol or
> number that begins with "."

I think the *look* of period+space/tab is nice, but the implementation problems 
are getting to be rediculous.  Leading period is *especially* problematic in 
Scheme, since it can indicate a number *or* symbol, and a "." by itself is the 
symbol used to quickly create improper lists.  It creates the need for a lot of 
gyrations, and a dependency on an unread-char that isn't universally supported.

But having a non-whitespace character for indent is turning out to be 
remarkably useful:
1. It's great when whitespace is dropped (e.g., HTML email)
2. It's great for highlighting regions.

We could use "~", but Arc uses leading "~" for not.  In the cases where you 
always put the condition after the word "if" this doesn't matter, but since Arc 
has *alternating* condition / action syntax, I'd expect Arc text to sometimes 
look like this:
if condition1
   action1
   condition2
   action2
   condition3
   action3
...

We could use "!"+space/tab.  That's actually a little better than "."; you 
really need to hand off handling of "." to the underlying modern-expression 
parser (because "." is complicated.  I think we could isolate its complications 
to the indentation processor if it's not a period, *without* the lower-level 
reader needing to know.  But it'd still create complications in its 
implementation.  Compared to the stark simplicity of "! is an indenting 
character" it's breathtaking.

This would obviously be slightly annoying to languages like wart, where leading 
"!" has a meaning.  But I think those cases are rare, and this only matters if 
it's just after indentation... so:
if !myfunction(...)
could retain that meaning if desired.

--- David A. Wheeler

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Readable-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/readable-discuss

Reply via email to