• Advertisement
Sign in to follow this  

Smart tricks / hacks

This topic is 737 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

The other day, I had an error from Lua that it missed an "end" at <EOF>, from a function that started 300 lines up.

My editor knows how to jump to matching parentheses, but it doesn't know how to jump to a matching 'start of statement' from and 'end', so how to solve this?

Then I realized the syntax highlighting colors "end" of a normal statement blue, and "end" of a function yellow, and I could use that to find the point of the missing "end".
So I inserted an "end" at a line at the top-level. If it got colored yellow, I'd be too high, if it got colored blue I'd be too low.
By using this trick I found the missing "end" statement in less than a minute. Edited by Alberth

Share this post


Link to post
Share on other sites
Advertisement

My editor knows how to jump to matching parentheses, but it doesn't know how to jump to a matching 'start of statement' from and 'end', so how to solve this?

Get a better editor?

Any competent editor should be able to figure out the beginning/end of a scope in languages with syntactically-significant whitespace these days. Edited by swiftcoder

Share this post


Link to post
Share on other sites
I thought it would be fun to exchange clever tricks, but if you want to change it into an editor or language war, be my guest, but I won't play. Edited by Alberth

Share this post


Link to post
Share on other sites

I thought it would be fun to exchange clever tricks, but if you want to change it into an editor or language war, be my guest, but I won't play.

 

Very true,  all is just for fun, exchange clever tricks or  talking about not so clever editors. All the same jokes mate, no wars, just jokes, absolutely nothing personal

Share this post


Link to post
Share on other sites

Lua doesn't even have syntactically significant whitespace :P

which is why it's a decent language ????( º _ º?)

Share this post


Link to post
Share on other sites

I thought it would be fun to exchange clever tricks, but if you want to change it into an editor or language war, be my guest, but I won't play.

 

You posted it in the "coding horror" humor section, so I genuinely thought by "clever tricks" you jokingly meant bad tricks or tricks to work around bad tools.

 

That's why other posters mentioned turning it into a joking thread of mistakes their favorite editors make - not an editor war trying to claim which is best.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement