Tag Info

Hot answers tagged

26

They are named differently because semantically they are quite different: A collection's Count is the number of items currently stored in it and can potentially change over time. An array's Length is the maximum number of items it can hold (it will have a length of 10 even if you haven't stored that many items in it) and is immutable. Example: If I have ...


8

The earliest reference I can find is from the "B" programming language developed by Ken Thompson with Dennis Ritchie around 1969. B Reference As this was an implementation/improvement of BPCL I have to assume the operator was part of BPCL but I cannot find a specific reference for this.


3

does any of them actually exploit some corner of the JVM, which has not been peeked into by the Java language? This has nothing to do with the language. It's a question of how a particular language implementation uses the JVM, unrelated to the language itself. For example, there are two different implementations of Ruby for the JVM, one uses ...


2

Notice that a complex program does not need to be coded in several languages. For example, the Linux kernel is a complex program (of more than ten millions source lines of C code with a bit of assembly). And the GCC compiler has more than ten millions lines of C++ code (it was C code before 4.5, and switched to C++ in GCC 4.8), some of them being generated ...


1

The most obvious and critical example is binary interfaces that power most cross-language and OS interactions. They almost universally have side effects (e.g. filling out pointed-to objects) and return values (e.g. was the operation successful) that in more advanced paradigms would be a return value and an exception, say, or a more complex return value.


1

You compile each source file into object files using the appropriate complier for its language, then link the object files into an executable, the same way you would for any other program. For this to work, all the compilers have to agree on how the modules communicate with each other. This includes things such as: what symbol names the objects export and ...


1

I expect in every implementation of C, the conversion happens first. The psuedo-assembly for bar: store 2 in argument-register-0 call foo store 3.1 in temporary-register-0 convert-to-int temporary-register-0 into temporary-register-1 store temporary-register-1 in argument-register-0 call foo Your optimizer is probably smart enough to eliminate ...


1

It has been suggested that I could create another representation of the AST just for semantic analysis that links back to the AST but that seems like a lot of work and redundant code... I don't think it means a lot of work and a lot of redundant code. Your typed AST could mostly contain the type information, and a reference (e.g. a pointer) to the ...


1

I am really surprised nobody pointed this out. Answer: It would not benefit you significantly, even if it was mutable. It would not benefit you as much as that causes additional trouble. Let's examine two most common cases of mutation: Changing one character of a string Since each character in a Java string takes either 2 or 4 bytes, ask yourself, would ...



Only top voted, non community-wiki answers of a minimum length are eligible