Today I watched a video over at the java.sun.com website that introduced some of the features of the JavaFX language. Some aspects of it reminded me of my first formal education in computer science - COSC 121 at the University of Canterbury in Christchurch, New Zealand way back in 1995. We were taught about Modula-2, which is a procedural programming language similar to Pascal.
I'm a little curious to know why the implementers of the language chose to have parameter type and return type information specified after the variable name and parameter list respectively - like Modula-2 and co. - as opposed to having it prior to the variable name or function name, like Java and the C family of languages.
e.g.
function area(radius : Number) : Number
{
return PI * (radius * radius);
}
compared to:
double area(double radius)
{
return PI * (radius * radius);
}
I'm not going to lose sleep over it, and can't look for more info at the moment as the Sun sites are experiencing some scheduled maintenance downtime.
The way that programmers can choose the size of increments in an expression also reminded me of Modula-2:
java.lang.System.out.println ([1..10 step 2]);
seems like one of Modula-2's looping mechanisms:
FOR Index := 5 TO 25 BY 4 DO
WriteInt(Index,5);
END;
No comments:
Post a Comment