Reputation
15,865
Top tag
Next privilege 20,000 Rep.
Access 'trusted user' tools
Badges
1 39 63
Newest
 Good Answer
Impact
~216k people reached

Jul
1
comment Is a function plotter a legitimate use of eval() in JavaScript?
@BenjaminGruenbaum With plain recursive descent, you have to either restructure the grammar to avoid left recursion (something I never quite got the hang of, I admit it), or drop operator precedence. The algorithms I mentioned are as simple as recursive descent, and have handling for operator precedence built in.
Jul
1
comment Is a function plotter a legitimate use of eval() in JavaScript?
@SK-logic Metaprogramming is good if it's what you want. And when you want metaprogramming, there's more tools for metaprogramming than eval. eval is without a doubt the most powerful, but it's also more brittle and dangerous than more specialized tools. For example, there is no reason to use eval for getting an attribute dynamically, as in eval('obj.'+attrname) - that's what obj[attrname] is for.
Jul
1
comment Is a function plotter a legitimate use of eval() in JavaScript?
@SK-logic I've never created a plotter, so I refrain from guessing. And in my experience, just evaluating simple math is simpler than robustly mapping it to another language. For such simple operations, evaluation is trivial.
Jul
1
comment Is a function plotter a legitimate use of eval() in JavaScript?
@SK-logic If the evaluation of the function is the bottleneck, yes. Otherwise it's probably not worth the extra twenty lines. While we're talking about performance, note the point of another answer that repeated eval would needlessly parse the JS code again and again.
Jul
1
answered Is a function plotter a legitimate use of eval() in JavaScript?
Jun
29
comment Uses of persistent data structures in non-functional languages
Your question appears to be less about use of persistent data structures in non-functional languages and more about which parts of concurrency and parallelism aren't solved by them, regardless of paradigm.
Jun
28
comment Why can't `main` return a double or String rather than int or void?
What would a double return value mean? What would a string return value mean?
Jun
28
comment Why not have a High Level Language based OS? Are Low Level Languages more efficient?
Not quite true. While you'll need some code that doesn't use X to implement X, all remaining code can depend on that code and use X.
Jun
28
comment Why not have a High Level Language based OS? Are Low Level Languages more efficient?
Your first paragraph makes no sense. An I/O driver in C doesn't use stdio.h either. A custom mutex implementation doesn't use pthreads. That's precisely what it means to implement it yourself! And that is independent of the language you're using. That is not to say high level languages are a good choice for low level tasks (they usually aren't in my experience).
Jun
27
comment How do functional languages handle random numbers?
A true RNG can't be a computer program at all, regardless of whether it is pure(ly functional) or not. We all know the von Neumann quote about arithmetical methods of producing random digits (those who don't, look it up - preferably the whole thing, not just the first sentence). You'd need to interact with some non-deterministic hardware, which of course is impure too. But that's just I/O, which has been reconciled with purity several times in very different wans. No language that is in any way useable disallows I/O completely - you couldn't even see the result of the program otherwise.
Jun
24
comment Except garbage collector, what else makes Java a non real time programming language
@mouviciel (1) The answer doesn't say that. The comments do, which is great, but the answer is to the effect of "Java is not real time because it runs on non-real time OSs". (2) It is true that just writing it in C++ isn't enough for (hard or soft) real time, and OP appears have that misconception. That means a good answer might limit itself to discussing why it's false. But even if I interpret this answer as trying to point that out, I cannot consider it a good answer. It's subtle to the point of not stating it at all. It only points towards one issue of many.
Jun
24
comment Except garbage collector, what else makes Java a non real time programming language
@PieterB Yes, as I said, it's quite important but it does not answer the question which explicitly contrasts Java with other languages.
Jun
24
comment Question regarding Readability vs Processing Time
@Jordy Even on a microcontroller, the compiler may output identical code for the two (or for an equally flat and readable rewrite of the second). I can't believe I'm saying this, having suffered at the hands of Keil µC, but even microcontroller compilers have a few tricks up their sleeves.
Jun
24
comment Question regarding Readability vs Processing Time
Compile it and benchmark it. I bet you there won't be any measurable difference. That is because your model of performance has been out of touch with reality since a decade or two, possibly longer. Learn how compilers and CPUs work.
Jun
24
comment Except garbage collector, what else makes Java a non real time programming language
@schlingel Sure. And if you a potentially-real-time implementation of another language (say, C, where it's the norm) on the same non-RT OS, that doesn't help much either. In other words, this issue applies to all language implementations.
Jun
24
comment Are there mainstream general-purpose non-Turing complete languages available today?
@SK-logic CSS does make sense without HTML, it can be applied to any kind of XML and nothing stops you from implementing it for any other format with roughly compatible shape (trees with named nodes, sibling order, etc). I've personally written CSS rules for a SVG file. It's just far more common for HTML because HTML is far more common than the other formats.
Jun
24
comment Except garbage collector, what else makes Java a non real time programming language
While this is a very important point for hard real time in general, it doesn't appear to be Java specific in the slightest. Am I missing something?
Jun
21
awarded  Enlightened
Jun
21
awarded  Nice Answer
Jun
20
comment Is there a kind of programs to illustrate most features and usages of different programming language?
@KarlBielefeldt Done.