Re: Use of whitespace
"Eric Merritt" <cyberlync-/[email protected]> Wed, 06 Aug 2003 15:39:56 -0000
| Newsgroups | gmane.comp.programming.pragmatic |
|---|---|
| Message-ID | <[email protected]> |
> The first time I stubled over a language which used formatting was FORTRAN
> and I hated it.
I have done a bit of RPG and its the same way. Column based formating sucks.
> But when I saw Python, I realized that the formatted approach has its merits
> and today, I can't think of a better way to structure code.
I tend to agree. I actually expected a big negative response, but no one seems to
have an opinion outside of ourselves.
> Pros:
>
> 1. It makes all code more readable. You just won't find badly formatted
> code because that code wouldn't work.
>
> 2. You indent anyway, so why not use it to our advantage? Java/C wastes
> a lot of screen space with the {} and even after all those years,
> you still find "if() {" and "if()\n{".
>
> 3. The code tends to be less complicated too. When you have this:
>
> for ...
> if ...
> if ...
> if ...
> if ...
>
>
> a = 1
>
> then you start to wonder at which level "a = 1" is. Usually, I simplify
> the code then to make it more readable.
yes refactoring would be called for in this situation.
>
> Cons:
>
> 1. People dislike formatted languages no matter how many advantages
> they have.
It usually a gut instinct reaction. I had it when I first saw python.
> 2. Tabs and Spaces are still a problem with many *users* of editors. All
> editors can handle them in such a way that Python can determine the
> correct (ie. wanted) indentation but people complain "why can't I set
> tabwidth to 3?". Tabs must stop at a multiple of 8 spaces or things
> start to break apart when you start mixing them.
I personally think that the best method here is to make tabs an invalid character in
the langauge. Then it becomes a moot point. All you have to do to make this
happen is do a tab-expand in your editor and you are golden.
> *Maybe* it is really time to leave the ASCII domain and start using
> a real wordprocessor for the IDE. There are many WYSIWYG text components
> out there and imagine to have formatted comments in your code!
I just see these as two different problem spaces. I am afraid that even the thought
of this makes me cringe.
> Or the file format for the source files could be XML (which means they
> can be (pre-)processed by a lot of tools and the syntax will be easily
> extensible when we don't use a DTD ;-). Then, the IDE could display
> that in a lot of ways.
When I first read this I almost blew chunks all over my screen, but it does make a
wierd cond of sense.
Once I got over my gut reaction to actually writing code in xml I realized that we
still have a few problems.
XML is way to verbose.
XML is not very readable when most of the code is in tags.
Can you imagine writting code in xml? I cant. I do understand your point about
parasiblity. However, our language syntax must be pretty simple and regular to
make the macro system work. With this in mind a parser will probably be simple to
write. Also a parser will be included in the platform so tools could make use of
that.
btw, the call of volunteers for an additional langauge designer is coming up. If you
have the time you may want to consider volunteering.
------------------------ Yahoo! Groups Sponsor ---------------------~-->
Buy Ink Cartridges or Refill Kits for Your HP, Epson, Canon or Lexmark
Printer at Myinks.com. Free s/h on orders $50 or more to the US & Canada. http://www.c1tracking.com/l.asp?cid=5511
http://us.click.yahoo.com/l.m7sD/LIdGAA/qnsNAA/W4wwlB/TM
---------------------------------------------------------------------~->
To unsubscribe from this group, send an email to:
pragmatic_lang-unsubscribe-hHKSG33TihhbjbujkaE4pw@public.gmane.org
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/