last day (894 days later) » 

11:00 PM
You guys like that too?
 
We have auto. But I suspect that is not what you mean?
 
no
I mean kind of like concepts
 
example?
 
so e.g. a forward iterator in go would be an interface
it's a set of operations
it's not explicitly implemented
so in practice it's really easy to write modular code
you specify your input variables to provide those operations you need - instead of explicitly specifying the type - and that makes it really easy to replace the implementation.
so much more practical than normal inheritance :-)
So something I see in day-to-day work:
A class has some method Abc()
 
@EamonNerbonne Sounds like templates to me :)
 
11:07 PM
well, but cleaner for its purpose
you get much nicer compiler diagnostics
 
Templates with Concepts then?
 
and you get much better orthogonality
yeah
 
Scala also has those, I think they're called "structural types".
 
but back to the example: interface A with method Abc(); interface B with method Pqr(); interface C with method Xyz()
now I need my parameter to support both interfaces A+B
what do I do?
happens all the time to me.
Or I have a method that produces and object that can support some behavior
 
In Java you would say static <T extends A & B> void foobar(T x); or something.
 
11:10 PM
this object supports B+C
how do I declare that return type?
Yeah, so that java code is quite unwieldy - you'd get mighty tired of reading and writing that all the time.
and of course, it gets much much worse the more interfaces you have.
And you know, a more fundamental problem: my coworkers don't exactly all love templates/generics galore.
Lots of those template declarations? That's going to be a total productivity drain
 
s/coworkers/cowards/
 
:-)
sure maybe - but the point you're trying to get work done, not fight the type system. The type system is there to help!
So somebody defines interface A_B which inherits from A and B, most implementations use that and all is well
much easier to write methods now
but then you have millions of these combined interfaces to make
and to inherit
and you think; I don't really need them; but then, for return types you really do.
That or you make your code even more complicated and pass output parameters or sink methods
...which in turn inherently cannot use tricks like auto or type inference because you need to specify which combined A+B implementation you actually want.
In C++ due to templates it's not quite so bad
but in java... oh boy.
 
room topic changed to Java Sucks: Where Eamon complains about primitive static type systems. [java]
 
:-)
hides in a corner
Ok one more poke
just look at java's List interface:
W...T...F...
the reason for these enormously overcomplicated interfaces is that it's very hard to do orthogonal design in java
because of this A+B problem
since that forces you to subclass for combinations of concepts
you better make sure your subclass captures all necessary cases, because you can't well add to it.
ok, I'll run.
 
The Java Collections Framework isn't that great.
Really looking forward to the next version designed around lambdas and concurrency.
 
11:23 PM
sounds like an improvement
(Scala's structural types look a lot like go's interfaces indeed!)
 
It seems Scala has everything one could possibly want.
They also have "path-dependent types", but I never figured out what that means :)
 
Did you ever hear of F#'s type providers?
Another one of those magic bits of things I wish I knew more about :-)
 
11:39 PM
Die Java hatters Die !!!
just kidding lolo
what up ?
System.out.exit(0);
 
path dependent types look like they'd address some of the iterator rant before... :-)
nice stuff!
 
user142019
11:53 PM
 
user142019
 
user142019
 
3 messages moved from Lounge<C++>
 

  last day (894 days later) »