A modest indentation proposal

phil hunt philh at comuno.freeserve.co.uk
Sun Dec 2 00:05:29 EST 2001


On 30 Nov 2001 20:07:25 GMT, Quinn Dunkan <quinn at chunder.ugcs.caltech.edu> wrote:
>On Fri, 30 Nov 2001 14:25:12 +0000, phil hunt <philh at comuno.freeserve.co.uk>
>wrote:
>>If I ever design a Python-like language, there will be 2 alternate syntaxes,
>>one with and one without semantic indentation. So people will be able to
>>write
>>
>>   if x > 3:
>>      a := b + c
>>      print a
>>
>>or:
>>
>>   if x > 3: {
>>      a := b + c;
>>      print a;
>>   }
>>   
>>(Though why anyone would prefer the second way is beyond me).
>>
>>The language would be stored internally in a form resembling the upper
>>of the two, and there would be automatic translators so everyone could
>>see it the way they liked, with {} or not, with whatever number of 
>>characters per indentation they liked, spaces/tabs, etc.
>
>http://www.haskell.org/onlinereport/lexemes.html#lexemes-layout
>
>I don't entirely like it because error messages can be confusing ("missing
>close brace" when you mess up indentation) and code that uses both at once can
>be confusing.  I'd rather have only indentation or only delimiters.  Having
>both and a rule to magically transform from one to the other is too
>complicated.

You could have separate filename extensions .lang and .langb for example.
So wether a particular code fragment nused brackets would depend on what
extension its file has.


-- 
*** Philip Hunt *** philh at comuno.freeserve.co.uk ***




More information about the Python-list mailing list