5 ms·
I agree with his view, but I could never find a static typed language that was useful in a long run. Haskell was amazing as long as try don't need to do much i
by viraptor 14y ago
I agree with his view, but I could never find a static typed language that was useful in a long run.
Haskell was amazing as long as try don't need to do much io. When I started spending more time fighting the constraints than being productive I stopped.
Ocaml was also not bad. But their strict restrictions on what opetators can be used with what types is annoying when you do lots of calculations. Having to explicitly cast numbers all the time was not inviting either.
Rust sounds great, but after a day of playing with it I saw it's really not ready yet. A couple of places needed wrapping in "unsafe" block to start working as expected. Some keywords and ideas were also going to change soon. I couldn't get used to the restrictions coming from not having exceptions or early function returns. It really adds some maintenance code.
Scala was probably the best so far, but the heavy vm is annoying.
So... still waiting for that perfect language.
- wiradikusuma 14y agoThen you should probably invest in Scala. The (J)VM is actually a blessing, Scala is standing on the shoulder of giants. I'm not talking about Oracle, but other languages that depend on JVM such as Clojure, etc, that will (hopefully) push the VM forward.
- viraptor 14y agoI don't like Scala being based on JVM/.NET for the following reasons (I know many people don't agree, this is all subjective): - inherited null (I love Option<> and Either<> pattern and exceptions, nullable stuff is a problem) - relying on foreign ecosystem (you end up with half functional, half "we have inherited all this mutable stuff, so let's use it" ugly mixture) - startup time (if you write things that are script-ish in nature, this is really annoying)
- wiradikusuma 14y agoThe first two are required for Java compatibility, the latest probably can be mitigated by compiling it to native using LLVM (http://greedy.github.com/scala-llvm/ http://greedy.github.com/scala-llvm/) (I haven't used it).
- pjmlp 14y ago> - startup time (if you write things that are script-ish in nature, this is really annoying) Just compile your code to native using a native code compiler for JVM bytecodes. There are quite a few to chose from.
- NateDad 14y agoTry Go. No vm. Compiles super fast (one of the most annoying parts of static typing when used for big programs). Obvious and easy to use closures. Implicitly fulfilled interfaces for painless compile time duck typing, and type inference for less typing.
- dons 14y agoOf course it has a "VM" (aka runtime system), providing services like thread scheduling, garbage collection, IO management and so forth. It might just not be an easily accessible standalone VM like the JVM. > Compiles super fast Because it doesn't do anything. Seriously, it compiles fast because the type system is so trivial. No type inference (except the really restricted (:=) thing. And I can't even have polymorphic functions -- which we've known how to type check for around 40 years now. This is a serious drawback if you are interested in type system support for code reuse.
- mseepgood 14y ago> Of course it has a "VM" (aka runtime system) VM != runtime system. VM == virtual machine, bytecode.
- dons 14y agoVirtual machines most certainly do not require bytecode. GHC for example targets the "Spineless, tagless G machine" by compiling to native code that calls runtime services defined by the (abstract) STG machine ISA (the "primops"). Similarly, Go targets the Go runtime, by compiling to native code that calls "machine" services like collecting memory or scheduling threads. It might be a thin wrapper over the underlying processor architecture, but the compiler is clearly targeting the Go runtime as its target "machine".
- mseepgood 14y agoThe Go runtime does nothing what a machine does. Compiled Go code consists of pure, native machine code instructions, no special opcodes. It's just that some additional functionality is statically linked in.
- anon1385 14y ago>I couldn't get used to the restrictions coming from not having exceptions or early function returns I'm probably being getting confused about what you mean here, but I thought you can return from anywhere in a function in rust using 'return'. I think Option types are one way to propagate errors back up the stack (with the compiler forcing you to handle them), but I don't know how practical that is in reality. I agree that Rust isn't ready for production use though, even in the few weeks I've been trying it they have decided to change parts of the language. Also the standard library is lacking in documentation and is pretty inconsistent.
- viraptor 14y agoWhat I mean is that if you don't have exceptions and `return` returns only from a given block, it takes some serious exercise to break out of a "fn ... { ...each { ... match ... } } }". Return will only return from one of them, so to signal an error from the match block, you need to: - save the result in a mutable variable in a function - do something that results in "false" returned from each block - return the result from the function (probably casting mut->immut on the way) What I'd really like is either a stack unwinding exception, or a `return` keyword that's different from the "last expression in a block" syntax. Last expression could give a result for a closure, match, if, etc. while `return` could always break out of a function. For example (pseudo-code, proper syntax doesn't matter here): fn parse_into_list(s: &str) -> Option<Stuff> { let res = do s.map |c| { match c { bad_character => return None ... } } Some(Stuff(res)) } Instead of: fn parse_into_list(s: &str) -> Option<Stuff> { let mut result: ...; let mut correct: true; do s.each |c| { match c { bad_character => {correct = false; false} good_character => { do_stuff_with_result; true} } } if correct { Some(Stuff(result)) } else { None } }
- laureny 14y ago> So... still waiting for that perfect language. Have you looked at the new, post-Scala, generation of languages, such as Kotlin? http://blog.jetbrains.com/kotlin/ http://blog.jetbrains.com/kotlin/
- viraptor 14y agoNo, but it's on the ToCheck list, right after Go.
- rlander 14y agoYou should check out Julia[0] and Dylan[1]. Both are dynamic with support for gradual typing and parametric polymorphism (multiple dispatch and generic functions). This, in my opinion, is the best of both worlds. [0] http://julialang.org/ http://julialang.org/ [1] http://opendylan.org/ http://opendylan.org/
- viraptor 14y agoJulia looks awesome from the description. I'll need some hands-on time with it :) I love the Kinds approach.
- p0nce 14y agoEver tried D? (don't believe the hype)
- viraptor 14y agoShortly. It was hard to find much information and from what little I got to experience, I'd rather take OOC or cython in cases where I'd otherwise want to try D. But that was before D2 - maybe it's worth giving it another go now...
- coldtea 14y ago>Rust sounds great, but after a day of playing with it I saw it's really not ready yet. Well, they never said it was ready. Actually they say the exact opposite: that it's still a moving target. It's 0.5 for a reason. Hopefully around this time next year there will be a 1.0.
- viraptor 14y agoI didn't want to imply otherwise, but languages have different paths to "ready". Some are stuck in 0.999 for ages, some are actually usable after 2.4 (python), some are quite stable without any specific number (ooc), etc. It's worth checking out your options early.
- Peaker 14y agoHaskell is great at doing much IO. How long did you try to use it?
- viraptor 14y agoNot long, but enough to rage-quit. This is very subjective, but if after 1-2 months I'm still finding myself in a situation of "oh god, this actually needs to do something useful; now I have to pull IO through half of this module", I'm starting to blame the language, not myself. I'd love to use haskell sans the academically pure approach to "the world". I'm not doing value computations - my applications spend most of the time pushing/pulling bytes outside of the system, so that part should be trivial. Maybe it's just not the right language for the job, maybe it's my approach. Either way, all the other great things about the language couldn't divert my attention from fighting to get stuff done.
- Peaker 14y agoHaskell can definitely take more than 1-2 months to pass the learning curve, especially without a good mentor. You generally shouldn't need to "pull IO through half this module", since you can just lift the large pure part with "fmap" to operate on the inner IO. But using these combinators effectively does take some learning. The approach to IO that Haskell uses is not "academic", it is extremely practical: By typing effects you get immense practical, not academic, benefits. Pulling and pushing bytes outside the system is trivial.