14,270 reputation
13459
bio website
location
age
visits member for 4 years, 5 months
seen 35 mins ago

Dec
24
comment In functional programming, does having most of the data structures immutable require more memory usage?
Out of interest, which implementation of which languages do reuse space as you described near the end?
Dec
24
comment Which is better: to include HTML inside PHP code or outside it?
@jmort253 Have considered it, but I have very little PHP knowledge, so I couldn't speak for best practices in the PHP world.
Dec
24
comment Which is better: to include HTML inside PHP code or outside it?
This doesn't appear to be massively popular in PHP, but note that in other ecosystems, both are considered bad and the proper alternative is to create a template of all static parts with minimal logic to include dynamic parts, and then render it from the programming language.
Dec
18
comment Advantages and disadvantages of structuring all code via classes and compiling to classes (like Java)
@RobertHarvey I assume you're talking about restrictions by lack of multiple inheritance. Yes, one can emulate it with enough composition, but I'd hardly consider it acceptable. For example, an object that would usually implement two interfaces would have to be implemented twice, in subclasses of distinct base classes (and while both implementations could delegate to a common class, that's still a shitload of extra code and you can't easily turn an instance of one into an instance of the other).
Dec
18
comment Advantages and disadvantages of structuring all code via classes and compiling to classes (like Java)
Side note: If you remove abstract classes and interfaces, you're forcing people to use inheritance for subtyping and polymorphism. That's bound to produce awful code. Also, unless you add multiple inheritance (and handle the associated problems), it's incredibly restricted.
Dec
18
revised Why does Zend discourage “floating functions”?
added 421 characters in body
Dec
18
answered Why does Zend discourage “floating functions”?
Dec
18
comment Why does Zend discourage “floating functions”?
Some notes: Python has no equivalent to autoloaders. Marking something private is trivial in Python, for both module-level functions and class/instance attributes and methods (prepend a single underscore to the name). While it's true that we don't like static methods, we don't avoid a keyword for it because we couldn't, but because we don't need one (staticmethod is just library code, it doesn't need any changes to language semantics).
Dec
18
comment Why does Zend discourage “floating functions”?
@RobertHarvey That's not the reason though.
Dec
18
comment Should I use JSON just to use JSON
What's the alternative? Inventing your own data format?
Dec
18
comment is Microsoft LC random generator patented?
@GlenH7 I wouldn't know. Patent law seems crazy, especially in the US. (There's a patent application for the IsNot operator in VB.)
Dec
18
comment is Microsoft LC random generator patented?
That's the license for the wiki page as a whole. IANAL but I wouldn't be surprised if there were a bazillion ways content included in the text might be patented or otherwise restricted (e.g. a trademark being mentioned in the text doesn't mean you can use the trademark by the terms of the FDL).
Dec
17
comment Is true multithreading really necessary?
Yes, your language as described here has both. I answered under that assumption.
Dec
17
comment Is true multithreading really necessary?
(1) That's a pretty freaking fragile model (on par with manual locking, I'd say) if is not immediately visible which calls may wait, all the way up. If it is, congrats, all your code just go uglier. (2) As I said, async APIs solve this issue but raise others. Even when done very well, they complicate all code involved. (3) Frequently giving up control is required for responsiveness, even if each individual function runs for very short time frames. I imagine it would be hard to add enough waits in the right places (I certainly wouldn't know where and how to do it in my code).
Dec
17
comment Is true multithreading really necessary?
@WinstonEwert I am aware, but I tend to ignore it, because I consider that an optimization and because relying on it may mean breaking Windows supports. I consider that unacceptable, so I work with this model in mind, though it's actually faster on some platforms.
Dec
17
comment Is true multithreading really necessary?
That's not what I'm thinking of. Note that CPython does not share code objects, or anything else for that matter. It imports all modules again -- can you tell me why? (I have vague ideas but nothing cold and hard.) Please, at least have a throughout look at existing attempts (cough Python multiprocessing cough).
Dec
17
comment Is true multithreading really necessary?
That's not the issue. The issue goes deeper: this approach (not unlike locking) simply doesn't compose, i.e., two functions which are safe in their own right may not be safe when put together (for example, when f can and should wait according to its intended use, the combination wants to chain f and g atomically). Prohibiting yielding everywhere doesn't help, it just makes cooperation harder (and puts all the burden on the programmer gluing stuff together). Making APIs async is an "easy" way out but now you need great tools for working with them, to maintain the simplicity.
Dec
17
comment Is true multithreading really necessary?
You may want to look into why CPython does not do that (at least code objects are immutable). And there are probably many potential issues atop of that. I'm no expert, I've just seen a lot of weird multiprocessing errors.
Dec
17
comment Is true multithreading really necessary?
@JonathanGraef Note that one still needs synchronization when any function one calls in a critical section may wait. For example, global_x = foo(global_x) is atomic iff foo is atomic.
Dec
17
comment Is true multithreading really necessary?
You're assuming the ability to run arbitrary code in other processes. It certainly doesn't work that way with CPython, and honestly I doubt anyone can make it work with all code. Did you implement a prototype (or at least did similar things in the past) or are still planning?