[Tfug] Language wars ( was Language choices )

Tim Ottinger tottinge at gmail.com
Fri Nov 3 13:08:15 MST 2006


More stuff inline. It's amazing how small the differences are in our
preferences.

On 11/2/06, Ronald Sutherland <rsutherland at epccs.com> wrote:
>
> > 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() )


Eww. With that parenthesized syntax it looks awful. It is a little better if
you use whitespace carefully:

(x>9).IfTrue( someCode )
       .IfFalse( OtherCode)

And of course, if you had closures or the like (and less demand for ".") it
might look more like
   x>9     IfTrue {
                    zz = SomeCode()
                    kk = somethingelse(zz)
                   print zz + " gave me " + kk
             }
             if False {
                   someOtherCode();
                   print "Maybe not";
             }

Which shouldn't be bewildering at all. Even to non programmers, I would
think.
I need to test that theory with my kids and In-laws.


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?.


You can make ruby very readable.  It has extremely low syntax requirement.
Probably could
approximate english better in ruby than you do in Basic.


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]


Right.  Better to have that buried in a named function (explanatory
function).
Maybe "current_conversion_value = power_supply.current_conversion_value();"


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.


If you know python, the pack functions are ugly.  You always need the "cap'n
crunch decoder ring" to figure out what it's doing.
That's clearly why we have  named functions!! Yikes.   BTW: I don't know:
      "current conversion value"
      "I2C"
      "IPMI"
I told you I was ignorant.



More information about the tfug mailing list