File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Other Languages and the fly likes Io: Prototype definition is a case of simplexity? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Languages » Other Languages
Bookmark "Io: Prototype definition is a case of simplexity?" Watch "Io: Prototype definition is a case of simplexity?" New topic
Author

Io: Prototype definition is a case of simplexity?

Hauke Ingmar Schmidt
Rancher

Joined: Nov 18, 2008
Posts: 433
    
    2
Hej,

I just read the excerpt on Io ( http://media.pragprog.com/titles/btlang/lo.pdf ). On page 66 you (i.e. Bruce Tate) explain the creation of types... well, prototypes. Io seems to be a language with extremly small syntactical overhead (p. 63: "There are no keywords and only a handful of characters that behave like keywords."), but I think here they (language creator[s]) gone a little too far here. You write: "Idiomatically, an object that begins with an uppercase name is a type, so Io sets the type slot.".

A clone which name begins with a capital letter (Car) behaves different than a clone with a minuscle (ferrari). It has a type slot that is non-existent otherwise and would be resolved by querying the respective prototype.

I am not entirely happy with this. This seems to be a case of simplexity for me. To avoid a operator or (beware!) keyword that clearly marks a (proto-)type, the syntax is hidden within naming conventions. Don't misunderstand me, I think naming conventions are highly useful and should be followed (and checked by tools within CI). But naming should not change semantics. This can lead to subtle bugs that are hard to find.

Well, just a thought I had when reading this.

(Well, one *could* guess that I am a fan of strong, static typing... I confess. The earlier a [potential] bug can be found, the cheaper it is to fix it - ideally when typing the suspicious code in the editor, anytime later costs time [and money].)
Bruce Tate
Author
Ranch Hand

Joined: Jun 04, 2002
Posts: 71
Hauke Ingmar Schmidt wrote:Hej,

I just read the excerpt on Io ( http://media.pragprog.com/titles/btlang/lo.pdf ). On page 66 you (i.e. Bruce Tate) explain the creation of types... well, prototypes. Io seems to be a language with extremly small syntactical overhead (p. 63: "There are no keywords and only a handful of characters that behave like keywords."), but I think here they (language creator[s]) gone a little too far here. You write: "Idiomatically, an object that begins with an uppercase name is a type, so Io sets the type slot.".

A clone which name begins with a capital letter (Car) behaves different than a clone with a minuscle (ferrari). It has a type slot that is non-existent otherwise and would be resolved by querying the respective prototype.

I am not entirely happy with this. This seems to be a case of simplexity for me. To avoid a operator or (beware!) keyword that clearly marks a (proto-)type, the syntax is hidden within naming conventions. Don't misunderstand me, I think naming conventions are highly useful and should be followed (and checked by tools within CI). But naming should not change semantics. This can lead to subtle bugs that are hard to find.

Well, just a thought I had when reading this.

(Well, one *could* guess that I am a fan of strong, static typing... I confess. The earlier a [potential] bug can be found, the cheaper it is to fix it - ideally when typing the suspicious code in the editor, anytime later costs time [and money].)


If you're one for structure, Io is not the language for you. It is absolutely wide open.

For example, consider the following program:

Object clone := ShootYourSelfInTheHead


And you're done. You can't create any more objects. There are many more colorful ways to shoot yourself than just playing with the case on a type. I found that it worked for me. A type is just a convenience in Io, not like a class in OOP. It's a tool used to help a programmer organize, and not one to help the language organize internally.

But no, I would not call it a fit if you really love strong, static typing. If you want a type system that will blow your mind, I'd recommend Haskell. It's intensely polymorphic and flexible. It is nearly fully inferred. The advanced structures that you can come up with, like Monads, are really amazing.

I hope this helps.
Hauke Ingmar Schmidt
Rancher

Joined: Nov 18, 2008
Posts: 433
    
    2
Bruce Tate wrote:A type is just a convenience in Io, not like a class in OOP. It's a tool used to help a programmer organize, and not one to help the language organize internally.


Hm, but there is a difference in (proto-)types and "non-type" clones, if I understood it correctly? Namely the "type" slot. It's just that this change is hidden within the capitalization that I stumbled upon. So capitalization gets part of the syntax. That's different to naming convention where e.g. constants are all-capital but this does not change semantics.


But no, I would not call it a fit if you really love strong, static typing. If you want a type system that will blow your mind, I'd recommend Haskell. It's intensely polymorphic and flexible. It is nearly fully inferred. The advanced structures that you can come up with, like Monads, are really amazing.


Thanks for the tip. Yes, I played around with Haskell some time ago and liked it ;-).
Bruce Tate
Author
Ranch Hand

Joined: Jun 04, 2002
Posts: 71
Hauke Ingmar Schmidt wrote:
Bruce Tate wrote:A type is just a convenience in Io, not like a class in OOP. It's a tool used to help a programmer organize, and not one to help the language organize internally.


Hm, but there is a difference in (proto-)types and "non-type" clones, if I understood it correctly? Namely the "type" slot. It's just that this change is hidden within the capitalization that I stumbled upon. So capitalization gets part of the syntax. That's different to naming convention where e.g. constants are all-capital but this does not change semantics.

That's a pretty minor difference. I bet it is implemented in a single line of Io code. Consider the difference between, for example, Java or Ruby classes and Io types. An Io type is an object with an upper case name... period. That's pretty astounding to me, actually.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Io: Prototype definition is a case of simplexity?