[Tfug] Language wars ( was Language choices )

Ronald Sutherland rsutherland at epccs.com
Thu Nov 2 21:19:59 MST 2006


Tim Ottinger wrote:
> On 11/2/06, Robert Hunter <hunter at tfug.org> wrote:
>   
<rm>
>> Actually, having blocks greatly reduces the number of things you need
>>     
>>> the language to do for you, including "if" and "case".
>>>       
>> Can you give an example?
>>     
>
>
>
> If boolean were a real class, and had an if true method you could pass a
> block to:
>
> x > 9 ifTrue: [someCode] ifFalse: [otherCode].
>
> There.  No need for "If" "else" in the language -- it's in the library.
> Send "ifTrue" to a boolean.
> Just another message going to just another object.
>   
I don't think I could use a language with only:

((x > 9).ifTrue(  someCode() )).ifFalse( otherCode() )

I have to write lots of small programs, and show them to customers and 
ISO auditors.
I have found they like a certain amount of plain English readability. 
Basic seems to get
them all *** (think dirty... if you spill coffee on a chair it is...), C 
and similar gets lots
of frowns, Python has passed the test a few times, I have not tried Ruby 
but it may be fine.
Can I make certain areas look like Basic in Ruby?.

I start to worry when I have to do things like:

ByteList = readIPMI(4)
IConv = struct.unpack('f',struct.pack('BBBB', ByteList[3], ByteList[2], 
ByteList[1], ByteList[0]))[0]

Which is used to get a floating point current conversion value form I2C 
bus with an IPMI power supply on it.
Unless you know Python its probably not clear.
>
>   
>> It amazes me how much language syntax the closure mechanism obviates.
>>     
>   





More information about the tfug mailing list