Have you ever restricted yourself to using a subset of language features?

Douglas Crockford’s book JavaScript: The Good Parts is a prime example of this. He lists ‘features’ in JavaScript that should be avoided and provides alternatives that use the ‘good parts’ of the language. A few of the bad parts are: eval slower, harder to read, dangerously insecure == confusing and ambiguous with differently typed operands … Read more

Why doesn’t Java varargs support collections?

The reason is simple: a variable arity parameter is simply an old-school array paramater with some additional metadata that tells the compiler to provide some syntactic sugar (namely, it allows implicit array creation). So from the perspective of the JVM Object… is pretty much the same as Object[]. Allowing collections as well would require a … Read more

Equivalent of Class Loaders in .NET

The answer is yes, but the solution is a little tricky. The System.Reflection.Emit namespace defines types that allows assemblies to be generated dynamically. They also allow the generated assemblies to be defined incrementally. In other words it is possible to add types to the dynamic assembly, execute the generated code, and then latter add more … Read more

Why do enums have computed properties but not stored properties in Swift?

enums do have stored type properties – i.e., static properties. They don’t have stored instance properties. I don’t know if there is a technical reason why stored instance properties are not available for enums. You may have to ask your question on the dev forum if you want a technical answer for “why”. In your … Read more

What is the purpose of long, double, byte, char in Java?

[*] With the possible exception of “short”, which arguably is a bit of a waste of space– sometimes literally, they’re all horses for courses: Use an int when you don’t need fractional numbers and you’ve no reason to use anything else; on most processors/OS configurations, this is the size of number that the machine can … Read more

What is a maximum number of arguments in a Python function?

In Python 3.7 and newer, there is no limit. This is the result of work done in issue #27213 and issue #12844; #27213 reworked the CALL_FUNCTION* family of opcodes for performance and simplicity (part of 3.6), freeing up the opcode argument to only encode a single argument count, and #12844 removed the compile-time check that … Read more