I need your opinion... (original) (raw)

Marek Kozieł develop4lasu at gmail.com
Mon Mar 23 17:04:13 PDT 2009


I'll try compare:

  1. Type inference It's nothing new that such code will be hard to read, and depending from implementation it will create lots bugs. This can be really hard to real as well. Here we need read 5th line to understand first. 0| addone(x) { 1| val result; /*inferred-type result */

2| val result2; /*inferred-type result #2 / 3| val boo = foo.getSome().getContext(); // boo is Boo<String,Container> 4| 5| result = x+1; 6| result2 = x+1.0; / this line won't work (in the proposed language) */ 7| boo = current,get(result); 8| return result; 9| }

What more we need analyse returned types to be sure that new value is correct to assign: 3rd line need to be analysed just to say if 7th is correct. All those make Type inference really hard to read.

  1. ':=' operator for values & consider '::' operator. they are one and the same, just :: is easier to read and do not need so many brackets.

(last := arraylist.get(( size := arraylist.size() )-1 ) ).getIdentificator().getName(); reading order(eyes): -> -> -> <- <- <- <- <- -> -> -> -> -> -> -> <- <- <- <- <- <- <- <- -> -> -> -> -> -> -> -> -> -> -> ->

arraylist.get( arraylist.size()::size -1 )::last .getIdentificator().getName(); reading order(eyes): -> -> -> -> -> <- <- <- <- <- <- <- <- -> -> -> -> -> -> -> -> -> -> -> -> -> -> ->

Both make some problems in if-s .... if ( ( a ) && ( c.getD::d ==5 )) // people expect for : ( c.getD::d ==5 ) to be not executed if ( a ) is true.

  1. 'final' without type It's clear and do not create more interactions (only one is intersection) But it need forget keyword, because people used to write 1 variable rather than 3 values, so amount of used names need to be decreased.

-- Pozdrowionka. / Regards. Lasu aka Marek Kozieł

http://lasu2string.blogspot.com/



More information about the coin-dev mailing list