Lobster game programming language


Now I'm in the mood to eat some Crustaceans...

Although seriously this looks pretty cool.
 
I never liked indentations as a way to declare blocks of code.

If you have multiple devs working and one uses Tabs, and another uses "Replace tabs with whitespace", especially if tab sizes are set differently, could lead to unpredictable results
 
It's a bit python like, which doesn't bug me much as I do a lot of data collection scripts in python.
 
Last edited by a moderator:
You can't guarentee that though

What if you had:

<tab>if( 1 == 1 ):

<tab><tab>print "1=1"

<spc><spc><spc><spc>print "Am I in If?"

If you're tab setting is 4, then "Am I in If?" will be no, but if your tab setting is 2, it's yes...
 
What if you had:

<tab>if( 1 == 1 ):

<tab><tab>print "1=1"

<spc><spc><spc><spc>print "Am I in If?"
I would replace the spaces with tabs to be sensible and wish pain upon the one who thought it was a good idea to mix spaces with tabs.
edit: incidentally, tab width doesn't matter, python counts whitespace as whitespace. The given code has the "Am I in If" at a depth of four with the tab at a depth of 1: if compiled, it will print as part of the if statement. By mixing tabs and spaces you are just making things hard (impossible even) for the person reading your code.

edit edit: apparently I'm mistaken, tabs are automatically treated as being 8 character stops. That is, a single <tab> will be replaced with an indent of 8, while <spc><spc><tab> will replace the tab with 6 indent, making the total 8, always to a multiple of 8. So in the code above, the if has an indent value of 8, and the "Am I in If" statement has an indent value of only 4: it isn't part of the if statement.

Moral of the story: stop mixing tabs with spaces. There are special places in purgatory for people that do so.
 
Last edited by a moderator:
I used to dislike Python for the spacing/tab/lack of braces, but overtime (and writing some pretty extensive applications with it) I found you just get used to it, and then you find you have nicely tabbed code. It is simple with the major SCM to reject commits if they have double spaces (and instead ensure tabs are used) which helps. I also found that you end up with less confusion for example, in C:


if ( x )
if ( y )
DoSomething( )
else
DoSomethingElse( )

In the above, most people would say the 'DoSomethingElse' gets called from a misleading place. Or (arguably worse still):


for ( x = 0; x < 10; ++x )
{
if ( x < 5 ) {
DoSomething( );

DoSomethingHere( );

if ( CheckSomething( ) )
DoSomethingElse( );
}
}

Again the tabbing/braces is confusing. Naturally (nearly) everyone can follow the tab flow, but in the above the tab flow doesn't match the braces so you have to read very carefully to work out what is going on.

FWIW, I spend 99% of my time doing C/C++ code, and I always brace AND tab/space correctly, but I still use Python quite a lot, and find it rather nice. I just always find the lack of static type casting to be a problem, but that is another story.
 
If you can't even agree with the members in your developement-team on which way of identation to use, this will probably be the least of your problems :D

The recommendation for Python is to use 4 spaces.  No tabs. Tabs are bad! Any proper text-editor will allow you to choose what to use (so you can press TAB and get 4 spaces), or even to replace tabs with spaces in the entire file.

Pygame is pretty bad when you need to refresh the entire screen for each frame ... if this can do better it might be just what I need. Would have to be "ported" to the pandora first, though(?)
 
Last edited by a moderator:
There are special places in hell for inconsistent coders/code.

IF you're the kind of person who does:

if ( foo ) {

  if ( y )

    bar()

}

Then you're an asshole :)

The same level of asshole who does:

#define macro *something*

if ( poof )

  macro;

where *something* is >1 line.

--

Pythons indenting rules are sort of annoying, but at least they're annoying with good intentions an dactually work PErsonally, whitespace is in the eye of the beholder, just like using colour or fonts is; but there sa lot to like about python, and the indeting rules don't hurt( and really help a lot.)

C is a great language; its kept its focus, unlike C++ (good christ, I've given up on..).

..

But Lobster .. looks _nasty_.

Reminds me of APL too much, and I'm not going back there :)

For a language which is to _help newbies_, it should be helpful, not obscure.

Sort of .. I like to call it 'core competence'; if something is designed for X, but it takes a lot of work to get X done, it has failed; imho, Struts in Java is like that; theres a lot of machinery at work, a lot of config files and copy/pasta all over the place, to get some basic stuff done, that coudl be done in a couple lines of python. As such, I'd say Struts1 has failed at its core competence (but I'm biased that way ;) ... Lobster may be rgeat, I've not looked too hard, but it looks like it may be a pita for newbies to learn, which is likely 3/4 of its audience.

jeff
 
I use Tabs Deal with it!

I found the space method sucks when taking over people's code.. a good editor can display tab widths differently to someone's preference and has no ill affect to the code.. but if you take over code where one guy uses 5 spaces, verses another that uses 4 or less then things get messy and you're spending a good amount of time correcting this.

I don't care what some BS standard says on this.. Tabs make more sense in my book.
 
and here we go back to my point on why I dislike indentation to identify blocks of code.

Even just having an "End" (whooo BASIC) or even reverse "fi" (like bash) to end the block seems really sensible to me.

Anyway, I think I've derailed this thread enough now ;)
 
I found the space method sucks when taking over people's code.. a good editor can display tab widths differently to someone's preference and has no ill affect to the code.. but if you take over code where one guy uses 5 spaces, verses another that uses 4 or less then things get messy and you're spending a good amount of time correcting this.
The editors that convert tabs into spaces and then convert 8 spaces back into tabs (as if those extra 7 characters are going to kill you) are especially annoying. "Oh, this guy indented by 3. *sigh*, ok, I'll just set my tab width to 3 and... now everything is all messed up anyway".The special place in hell reserved for people that use spaces is paradise compared to what awaits these space/tab mixers.
 
Well I typically always use tabs and never spaces.. even in C like languages.
 

Luckily I only code for myself and never for other people.. I seem to take over a ton of other peoples code.. even one person who always used just 2 spaces for indenting in python..
 
Last edited by a moderator:
@TrashMG At the software houses I have worked at it has been tabs all the way in all languages (including assembly, c, c++, python, Jam, batch, shell). The coding standard also set tab width should be 4 spaces, that is so if thing are lined up (be it in comment diagrams, variable assignments, or whatever). It is a rule I have always agreed with, not that I have ever given spaces a fair chance, I have always used tabs and don't want to stop now!
 
Back
Top