I took those tonight:
matz, don’t let them turn Ruby into Frankenstein!
October 31, 2005There is a thread right now on ruby-talk, “Readability” inflation by David Black that raises some concerns about syntactic features creeping into Ruby, and I agree with him. More syntax is not the way to go, especially if it doesn’t bring clear advantages. We’ll just end up being like C++. Here are some snippets found on that thread.
Implicit variables
So, what we really need is the implicit block variable, because it can do
all that ;-)ary.sort_by { it.meth }
ary.sort_by { it.meth(foo, bar, wack!) }
and even:
ary.sort_by { some_hash[it] }
Dominik
Implicit block variables? No thank you! First of all, Dominik uses it in his examples, which is really bad, because I think if it as refering to the container object, not the individual elements in it. each would be a better name, but that’s besides the point, I don’t want this feature. Sure, it makes us repeat things twice and that’s longer to type, but you have to remember that more time is spent reading code than writing it. That’s why you hear much more about readability than writeability. So if having to type a name twice allows me to choose a good intention-revealing variable name instead of a generic name, then so be it. If you like implicit (or anonymous) variables, you should check out Factor which uses a datastack (like Forth).
You also have the problem of multiple block parameters, something like #each_with_key would be confusing: do you need to specify both block parameters or can you refer to the first one as each and you need to name the second? This causes more confusion for no gain. I don’t like this idea, and I hope matz doesn’t either.
Named parameters
This one’s another big subject in the community right now, and I don’t see why we don’t just sort of copy Python on this. With Python, you can do this:
def foo(a, b, c): return a + b + c foo(1, 2, 3) #=> 6 foo(1, c=3, b=2) #=> 6 foo(c=3, a=1, b=2) => 6
Why not just make it so that you can do that in Ruby? That seems like a simple solution, and you don’t enforce something on the user; if the users wants to use positional arguments, he can and if he wants to use named arguments, he can do that as well. I don’t know if we can use the equal sign, because in Ruby that returns a value. Maybe using => would work. Colons are out, because it would be too confusing:
def identity(obj) obj end # Clear foo(obj => 1) foo(obj => :foo) foo(obj => ::RELATE_DATE) # Not so much foo(obj:1) foo(obj::foo) foo(obj:::RELEASE_DATE)
See what I mean? Adding spaces clears things up, I guess, but that’s still pretty hard on the eyes, what do you think?
New block syntax
I already blogged on that subject, so just use the archives to find my opinions on the subject. Just want to re-iterate that I don’t see the need to change the current syntax, it’s pretty good the way it is, and about the { |z=x|y| } problem, wouldn’t parentheses fix the problem? And if not, couldn’t you just create a temporary variable with the result of x|y and use that as the default value of z? If the change to the lambda -> () {} occurs, then there should be a plan for deprecating {||}, we don’t need to syntaxes.
every
It was the first time I’ve heard of this, but it seems some people want to see an every method added to say ary.map{|x| x.meth} with this syntax: ary.every.meth. First, shouldn’t it be ary.every(:meth), and second, I don’t really think we need that (if someone does, adding every should be rather trivial). Some people mention that the first form is a bit cryptic to new users; maybe it is, but that’s no reason to change it. We can’t expect users to be able to use Ruby without any learning, can we? We’re not trying to make AppleScript here.
Well, that should be about enough ranting. What I mean to say mostly, is that David Black is right: adding syntactic features to Ruby isn’t really needed right now, our syntax is readable and people who are introduced to Ruby like it. Your girlfriend is beautiful, right? Do you really need to give her a botox treatment, new boobs, new teeths, a new hair style to make her better?
Let’s focus on making our beloved language faster, writing more third-party libraries to respond to the needs of users, documenting and most of all, let’s have some good ol’ Ruby-fashionned fun!
That’s what I’m talking about!
October 30, 2005An evening with friends and good beer. What more could a guy ask for?
Factor post deleted
October 30, 2005I have deleted the Factor post I made back in August, because it kept being “attacked” by spammers. I don’t know why this thread specifically, but in any case, I grew tired of seeing casino offers pending for approval in my inbox. So the thread is gone, I hope I won’t get more spam.
What to expect for C# 4.0
October 30, 2005Indigo Prophecy
October 29, 2005Last night, myself, Etien and Seb bought a (used) copy of Indigo Prophecy for the XBox. We started playing over at Seb’s place, and it’s a pretty good game! The controls absolutely suck, but the plot is great, and as an adventure game, you can make decisions in the game that affect future actions, so there is a level replayability not found in other adventure games, such as Run Away.
I highly recommend that you try it, it’s pretty fun: you control three characters, the killer and the two cops after him. Will you make sure the cops don’t get to the killer?
Oh, and another note, the EB Games guy tried so hard to sell extra stuff to Etien that he punched in the wrong price for his copy of Resident Evil 4. Instant 10$ rebate!
Lisp Alien!
October 28, 2005Woohoo! These logos are so cool! Lisp rocks! I really like the one “This program may contain trace amounts of Lisp”. Now, if we could just convince all the .NET 2.0 fans to just jump straight to where they are headed anyway, we could start having some real fun :)
iSight
October 28, 2005Last night my iSight arrived. I spent a good hour just making faces :-P One thing I noticed though is that the iBook stand doesn’t seem to be firmly gripped to my laptop. I tighted the screw, but I can still remove it without any effort. Any tips on that?
One hundred brazillion dollars!
October 27, 2005Spotted on bash.org:
Donald Rumsfeld is giving the president his daily briefing. He concludes by saying: “Yesterday, 3 Brazilian soldiers were killed in an accident” “OH DEAR GOD NO!!!” George W. Bush exclaims. “That’s terrible!!” His staff sits stunned at this display of emotion, nervously watching as the president sits, head in hands. Finally, the President, devastated, looks up and asks………. “How many is a Brazillion??!”
Ugly MS Access application
October 27, 2005Some Microsoft Access programmers should really learn how to design a GUI. I was watching a presentation yesterday and this guy showed an Access application and I thought it was really ugly. I don’t have a screenshot, but I can use the one above to make many points about what is wrong there
- The title isn’t centered and is useless, because that should be in the window bar
- The separation bar is ugly
- The number of months is not right-aligned like the rest of the fields
- The total number of kilometers (10000) doesn’t have the thousand separator like payment on account (2.400,00)
- The comments next to the fields aren’t really needed and their being in bold distracts attention away from the important fields of the application
- The buttons with images are really ugly, and the labels above them should be on the button
- The label above the email button isn’t centered and the button seems to have been randomly placed on the form (maybe it’s a game like when you need to stick a tail to an ass with your eyes covered when you are a kid?)
- The model contract button has a different font color and is underlined
- No button on this form has the same size
- I have no idea what the binoculars with a question mark button does
- The distance between the text fields under the “This price includes:” section is not equal. That’s equally true for the labels to their left
- One text field (the dressing of) is a tad longer than the others
A pretty bad UI. I think someone should read a book on designing good interfaces!
Posted by gnuvince
Posted by gnuvince
Posted by gnuvince