Semicolons: mostly unnecessary? Also, language oriented programming

Yigal Chripun yigal100 at gmail.com
Sat Oct 24 00:57:29 PDT 2009


On 24/10/2009 02:29, Bill Baxter wrote:
> On Fri, Oct 23, 2009 at 4:54 PM, Yigal Chripun<yigal100 at gmail.com>  wrote:
>> On 23/10/2009 19:41, bearophile wrote:
>>>
>>> Yigal Chripun:
>>>
>>>> The trade-off here is obvious: if you use line continuations like
>>>> in python they would be very rare but would not be automatic and
>>>> consistent when you do need to use them.
>>>
>>> In my Python code (or in good code you may find around, like in some
>>> modules of the std library) you may have a hard time finding few line
>>> continuations. Generally you can avoid them putting code in
>>> parentheses. And if/when you want to use them it's simple. So I think
>>> you are wrong.
>>>
>>> Bye, bearophile
>>
>> Nothing you said contradicts what I said.
>> The fact that they are rare in python means that you need to think if and
>> when you need to use them whereas in c/c++/d/etc you use semicolons
>> consistently throughout the code so adding them is an automatic action that
>> requires no thought.
>
> You don't really have to keep it much in mind.  Either your editor
> will tell you you've done something wrong by indenting things in an
> unexpected way, or if not, the parser will tell you when it does its
> pass to byte-compile the source.
>
>> here's an analogy:
>> there's a speed limit set by law inside cities so any driver with little
>> experience will automatically slow down when entering a city. that speed
>> limit becomes an automatic habit you don't need to think about.
>> however when you see a sign with a different speed limit you do need to
>> process that info in the brain and conscientiously change your speed.
>
> Think of the code editor / byte-compilation engine as the buddy in the
> passenger seat telling you to slow down.  Its not a problem when you
> have such a buddy.
>
> --bb

I didn't say it's a big problem. My only point was that one is performed 
unconsciously whereas the other is performed consciously.

I don't care to continue the semicolon debate. I don't think one is 
inherently better than the other. I have my own preference here but that 
all it is - a *personal* preference, not a god given rule.

====

If we are at the topic of language syntax:
Have you ever heard of MPS by Jetbrains?
MPS (meta programming system) is a tool to design your own language 
complete with an IDE, and everything else you get for a modern language.

The way MPS is implemented is interesting since they do away completely 
with working with text, parsing and lexing.
the language is defined directly at the AST level - as nodes with rules 
and types.
the editor is a structural editor that allows you to fill cells 
according to the defined nodes.

it's analogous to an XML editor where you define an xsd (node structure 
and their types/semantics) and the editor allows you to manipulate the 
tree structure directly. the structure is always well defined by the 
tree structure and there's no need to have statement separators or line 
continuations.




More information about the Digitalmars-d mailing list