-
-
Save wayneeseguin/1095634 to your computer and use it in GitHub Desktop.
| # I have now programmed in a lot of languages, and one thing I can say for sure | |
| # is that shell scripting does construct end styles very well. | |
| # | |
| # Example from http://redmine.ruby-lang.org/issues/5054 | |
| # | |
| # This is indeed also one of my few personal issues with Ruby syntax, the end trail. | |
| # | |
| module MyModule | |
| class MyClass | |
| def my_method | |
| 10.times do | |
| if rand < 0.5 | |
| p :small | |
| end | |
| end | |
| end | |
| end | |
| end | |
| # For longer codebases, this lets you more clearly know where you stand and | |
| # what is being ended. | |
| module MyModule | |
| class MyClass | |
| def my_method | |
| 10.times do | |
| if rand < 0.5 | |
| p :small | |
| fi | |
| od | |
| fed | |
| ssalc | |
| eludom | |
| # And allow for shortened forms, | |
| module MyModule | |
| class MyClass | |
| def my_method | |
| 10.times do | |
| if rand < 0.5 | |
| p :small | |
| fi | |
| od | |
| ed #'end def' | |
| ec # 'end class' | |
| em # 'end module' | |
| # es => 'end case' | |
| # | |
| # I *am* ok with this also :) | |
| # | |
| module MyModule | |
| class MyClass | |
| def my_method | |
| 10.times do | |
| if rand < 0.5 | |
| p :small | |
| # Suggested by @elliottcable: | |
| module MyModule { | |
| class MyClass { | |
| def my_method { | |
| 10.times { # This one already works ;) | |
| if rand < 0.5 { | |
| p :small | |
| } | |
| } | |
| } | |
| } | |
| } | |
@rkh I'd claim that was true however the git history would prove me wrong ;)
Well shit, if this is going to go on like this:
module MyModule
class MyClass
def my_method
10.times do
if rand < 0.5
p :small
end:if
end:do
end:def
end:class
end:moduleShort-hand ?:
module MyModule
class MyClass
def my_method
10.times do
if rand < 0.5
p :small
end:if:do:def:class:moduleVery short-hand:
module MyModule
class MyClass
def my_method
10.times do
if rand < 0.5
p :small
end:allAnd double hell with it. Let Ruby support Python style indention if : is used.
module MyModule:
class MyClass:
def my_method:
10.times do:
if rand < 0.5:
p :smallPostfixing the name of the start does not solve the problem.
- You write twice as much in most cases, you're now writing XML plus an extra character.
- This only looks swell if you're writing a module, with a single class, with a single method, with a single block, with a single if condition.
- Still requires you to keep track of the other end, which is the bigger problem here.
And while the joke continues here's a lovely one:
module MyModule
| class MyClass
| | def my_method
| | | 10.times do
| | | | if rand < 0.5
| | | | | p :small.i .ui!
how about,
module.MyModuleclass.MyClassdef.my_method10.times.doif(rand < 0.5)~p :small
Had to see that all hi-litey
module.MyModule~class.MyClass~def.my_method~10.times.do~if(rand < 0.5)~p :smallEek! It sucks :-D
Perhaps we can strip out even more characters and go the minimalistic approach! ;)
Hah. Yes, we had a long discussion about using Unicode box-drawing characters to denote blocks early-on in the development of Paws; I think we’ll have at least one patois playing with things like that in the long run.
Er, what do you mean tabs? I haven’t used a hard-tab in a fuckin’ decade! In fact, despite the shitstorm it abused, my language downright doesn’t allow hardtabs instead. #ew
This gist provides quite a lot of food-for-thought as a developer of a nascent programming language.
Now, that said, PLEASE STOP STUFFING MY INBOX WITH NOTIFICATIONS ;_;
@ELLIOTTCABLE I dont believe there is currently a way to 'unsubscribe' from a gist notification feed?
No, there’s not. And that’s the point of my all-caps request. ;D
HELLO GUYS HOW ARE YOU?
@wayneeseguin You just put that there, right? :D