4 ms·
You're wrong. I can write Lua, Python or Ruby code that does little allocation and would perform well (in a relative sense) on Dalvik. Those are all dynamic. I
by tumult 16y ago
You're wrong. I can write Lua, Python or Ruby code that does little allocation and would perform well (in a relative sense) on Dalvik. Those are all dynamic.
I could not write Haskell or OCaml code that performs well on Dalvik, because of their allocation profiles.
A language being dynamic does not have much to do with its allocation profile. Haskell and OCaml are not dynamic languages, but have allocation and deallocation profiles that grossly outstrip what you would see in typical Python or Ruby code.
Scala allocates most things on the heap and is probably unsuitable for use on Dalvik. What is your complain about Scala as a language?
- bad_user 16y ago> I can write Lua, Python or Ruby code that does little allocation and would perform well (in a relative sense) on Dalvik. Those are all dynamic. You MISS the point ... because everything can change, the semantics are different. A class can change ... first it needs to be garbage-collectible, with one way to do it being for every class to be loaded by a different class loader. Then the methods themselves can change, so in JRuby every method on a class has a corresponding method handler (another class at the VM level). Even if you write code that doesn't do much, you're programming in Python, not RPython, or in Ruby, not in Duby. You may use a subset of the language, but the interpreter has to be prepared for everything. I have been following the developments in the JRuby project, and I sincerely doubt that you can write efficient Ruby code on top of Dalvik ;) > A language being dynamic does not have much to do with its allocation profile. Again you miss the point ... it does have to do with its allocation profile if you're doing shit that doesn't match the JVM type system. And yeah ... Haskell and Ocaml both have type-systems much more different than those of Ruby/Python. > Scala allocates most things on the heap and is probably unsuitable for use on Dalvik So do JRuby or Jython ... AFAIK they don't do tracing compiling, and the JVM doesn't do custom stack-allocated values ... again, hard to match the JVM type system. On the other hand, Scala uses Java's call semantics, so the generated bytecode is efficient because for runtime-dispatch it follows Java's rules. In a language like Ruby or Python with its own rules about what to call, you need techniques like call-site caching implemented by the language author ... see http://en.wikipedia.org/wiki/Inline_caching http://en.wikipedia.org/wiki/Inline_caching ... one issue meant to be solved by InvokeDynamic (whenever Java7 ships). > What is your complain about Scala as a language? Too many features thrown in there, some non-orthogonal, just to please the JVM ... and I'm tired of languages with a complex syntax that don't provide a way for library authors to hook in the compiler's pipeline ... you get the worst of both worlds (unreadable code / not capable enough). I just want a syntax tree from some expression, which would enable me to work/use something like LINQ, or adding to it new syntax when you need it (have a look at Perl's MooseX to see what that can do). Is that so hard, especially for a language that comes with tons of other features, some of them improperly implemented? (IMHO, type-erased generics in a runtime-dispatch language are totally useless / thrown in there only to have local type inference ... and those manifests are just an ugly hack). But I already said, it's my opinion ;)