Wednesday, November 29, 2006
Monday, November 27, 2006
Ad-hoc protocols
Objective-C has the notion of protocols, which enable an object to say that it supports a certain set of methods. And Obj-C 2.0 extends on that with optional methods and concrete protocols. What about supporting ad-hoc protocols? For example:
- foo: (@read, @write) streamI'm not quite sure how optional methods in Obj-C protocols work, because a protocol by definition states what methods it supports. Optional requirements? :)
{
// 'stream' supports read() and write()
}
Optional typechecking
Steve had a quote about type inference on his blog and it reminded me of something. I seem to always come back to Dylan when looking for good ways to do something. Like optional (runtime) typechecking...
In Dylan, you can write a strict version, which checks the argument and the return type:
In Dylan, you can write a strict version, which checks the argument and the return type:
define method double (thing :: <number>)Or leave it completely open:
=> another-thing :: <number>;
thing + thing;
end method;
define method double (thing)Sometimes you don't care what kind of argument you get, you just pass it on. But sometimes you do, and it's nice when the system can tell you exactly where you went wrong.
thing + thing;
end method;
Sunday, November 26, 2006
F-Script and Smalltalk
I like the ideas behind Smalltalk a lot, but sometimes the syntax feels a little terse. I didn't know that F-Script introduced collection oriented methods like this:
Smalltalk:
It looks like this is simply a redefinition of methods and a little use of doesNotUnderstand:, so it should be possible in plain Smalltalk. Right?
Smalltalk:
(employees select:[: anEmployee | anEmployee age > 30])F-Script:
collect:[: anEmployee | anEmployee name]
employees name at: employees age > 30http://www.smalltalk.org/articles/article_20040920_a4.html
It looks like this is simply a redefinition of methods and a little use of doesNotUnderstand:, so it should be possible in plain Smalltalk. Right?
Reverso
In comp.lang.python,
Katarzyna Bylec wrote:
> > we would like to invite you to one of the biggest Ruby and Python
> > events in central-eastern Europe next year.
and Paul McGuire replied:
> Isn't this the week after the:
> Oil and Water Conference
> Gasoline and Dynamite Conference
> Hatfield and McCoy Symposium
LOL
Katarzyna Bylec wrote:
> > we would like to invite you to one of the biggest Ruby and Python
> > events in central-eastern Europe next year.
and Paul McGuire replied:
> Isn't this the week after the:
> Oil and Water Conference
> Gasoline and Dynamite Conference
> Hatfield and McCoy Symposium
LOL
Saturday, November 25, 2006
Desktop advancements
Even today, there are some are some nice ideas from older windowing systems such as Sun's Open Look and OS2's Presentation Manager that have not been incorporated into modern window managers, such as selecting a dragging multiple windows and icons being 'live' objects, not just filesystem shortcuts. The past is the biggest inspiration for the future.
Friday, November 24, 2006
The joy of dynamic dispatching
I like to write as little code as possible. One way to do that is to use method names (symbols), and use send() to dispatch on those values:
class EventNothing big, but using it often can eliminate a lot of if statements.
def initialize( type, args )
@type, @args = type, args
end
end
def send_event( event )
send( event.type, *event.args )
end
def mouse_down( origin )
puts 'mouse_down()'
end
view.send_event( MouseEvent.new( :mouse_down, [50, 50] ) )
Thursday, November 23, 2006
CellFactor
CFR_Screenshot_2.jpg
The physics look amazing. I'm tired of my C4 in Battlefield 2 not even putting a scratch on buildings. :)
The physics look amazing. I'm tired of my C4 in Battlefield 2 not even putting a scratch on buildings. :)
Saturday, November 18, 2006
Sunday, November 12, 2006
Interactive table and fishy technology :)
"Panasonic is showing off an HDTV interactive table. The background looks like a fish tank. The little fish are files. In the video the lady shows how to synch files from a future phone, make dinner reservations and tosses some windows back and forth with a person sitting on the other side of the table."
Simple but really addicting game
Flow uses dynamic difficulty based on the theories of Csikszentmihalyi. It's fun for the whole family! :)
PS3 demographic
Quotes from slashdot:
"Tomoaki Nakamura, 41, said: "I've been waiting for this day to come for so long. I'll play it all through the weekend. No time for meals."
Well, I guess that shows who Sony's demographics are, 41 year old men who put gaming ahead of basic biological function. Take that Maslow!
"Tomoaki Nakamura, 41, said: "I've been waiting for this day to come for so long. I'll play it all through the weekend. No time for meals."
Well, I guess that shows who Sony's demographics are, 41 year old men who put gaming ahead of basic biological function. Take that Maslow!
Wednesday, November 08, 2006
Disappearing email
I just launched Molizilla Thunderbird a few minutes ago, and to my surprise, all the mail in my Inbox was gone. What joy! Thanks to http://kb.mozillazine.org/Disappearing_mail I got everything back up again. But it's still scary. I could read the file and my mail was there, so I ended up using the sed filter to mark all messages undeleted.