Earlier quoted context omitted.
No I don't, and when someone cringes looking at my code, I shut up, apply the fix and get to improve my skills on the language, instead of excusing myself.
So you agree you should be judged as someone who doesn’t care in those cases also, right? You didn’t mention anything about people excusing themselves initially, just that you judged them. I just hope you hold yourself to the same standard.
Inside the JVM: Arrays and how they differ from other objects
121–130 of 133 posts
Re: Inside the JVM: Arrays and how they differ from other objects
#122Earlier quoted context omitted.
Like on street markets, we are having bonus today, and you get two for the price of one. https://www.ptc.com/en/products/developer-tools/perc https://www.aicas.com/wp/products-services/jamaicavm/
Both of these are meant for embedded development only. You implied before that there are major JDK distributions which are not based on OpenJDK, but these two examples do not show that: these are niche JDKs.
Re: Inside the JVM: Arrays and how they differ from other objects
#123Earlier quoted context omitted.
Like on street markets, we are having bonus today, and you get two for the price of one. https://www.ptc.com/en/products/developer-tools/perc https://www.aicas.com/wp/products-services/jamaicavm/
Both of these are meant for embedded development only. You implied before that there are major JDK distributions which are not based on OpenJDK, but these two examples do not show that: these are niche JDKs.
A JVM is a JVM, regardless of deployment scenarios and who gets to use them.
Re: Inside the JVM: Arrays and how they differ from other objects
#124> Another curiosity of Java arrays is that they can have a size of zero. > This code will not result in an error message. This surprising feature is used primarily by code generators, which might create an array and then discover there are no values to place in it. What? How can someone at Oracle have written this? Zero-length arrays are used all the time when you call a function asking for an array of "the latest st…
CL-USER 9 > (make-array 0 :adjustable t :fill-pointer 0)
#()
CL-USER 10 > (vector-push-extend 'foobar *)
0
CL-USER 11 > **
#(FOOBAR)Re: Inside the JVM: Arrays and how they differ from other objects
#125Earlier quoted context omitted.
Both of these are meant for embedded development only. You implied before that there are major JDK distributions which are not based on OpenJDK, but these two examples do not show that: these are niche JDKs.
Not only I am not here to save people's work, those were two examples when you asked for one, and now proven wrong, got to move goalposts with additional stuff, because "those don't count oh oh". A JVM is a JVM, regardless of deployment scenarios and who gets to use them.
I am not moving goal posts, I am just saying that a JVM specializing on embedded devices is not a JDK most people would use, only a small number of niche applications... so you haven't shown anything other than there are alternative JDKs available for niche applications, which I agree with! But I was saying that all JDKs people working on most applications rely on are based on OpenJDK. If you want to include a niche JDK for embedded devices, fine, but that's not what I or most people would care about, I would think.
It would be more pleasant to discuss with you if you expressed yourself a bit more like an adult (even if you're still a teenager which I am guessing is the case), by the way...
Re: Inside the JVM: Arrays and how they differ from other objects
#126Earlier quoted context omitted.
OK, so they're treated in a special way that's completely irrelevant to the concerns one might have when using multidimensional arrays. It's just an implementation detail with no practical considerations.
Yes
“A new multidimensional array of the array type is allocated from the garbage-collected heap. If any count value is zero, no subsequent dimensions are allocated. The components of the array in the first dimension are initialized to subarrays of the type of the second dimension, and so on. The components of the last allocated dimension of the array are initialized to the default initial value (§2.3, §2.4) for the element type of the array type. A reference arrayref to the new array is pushed onto the operand stack.”
It’s really a little utility method that happens to be pushed all the way to the byte code for historical reasons. The arrays it produces aren’t multidimensional in the ways you might hope, they are just arrays of arrays, which remain mutable and so can become ragged, or be reassigned in sneaky or horrible ways (e.g. with a subtyped array).
There has been lots of talk over the years about how we could do better, often motivated by projects like Panama which are concerned with interfacing with other languages which do have firmer concepts of multidimensional arrays, but these are generally at a slightly higher level and try to avoid messing with lower level things the VM has to know about.
Re: Inside the JVM: Arrays and how they differ from other objects
#127> Another curiosity of Java arrays is that they can have a size of zero. > This code will not result in an error message. This surprising feature is used primarily by code generators, which might create an array and then discover there are no values to place in it. What? How can someone at Oracle have written this? Zero-length arrays are used all the time when you call a function asking for an array of "the latest st…
In Common Lisp I might want to push elements to an array, and start with zero elements: CL-USER 9 > (make-array 0 :adjustable t :fill-pointer 0) #() CL-USER 10 > (vector-push-extend 'foobar *) 0 CL-USER 11 > ** #(FOOBAR)
Re: Inside the JVM: Arrays and how they differ from other objects
#128Earlier quoted context omitted.
Although be careful with that in Python because there are other situations where (x) and (x,) are both legal but mean very different things.
In Python the comma acts as a tuple creation operator inside parentheses with no other context like function invocation. Also, last I remember in JS a trailing comma meant the creation of an extra array element that’s null so I became conditioned to only use trailing commas for separators in languages where it’s consistent and specified very explicitly like in HCL
w = 0, # w == (0,)
(x) = (0,) # x == (0,)
y, = 0, # y == 0
(z,) = (0,) # z == 0
Though in Rust, parentheses are required for tuple creation and destructuring.Re: Inside the JVM: Arrays and how they differ from other objects
#129Earlier quoted context omitted.
In Common Lisp I might want to push elements to an array, and start with zero elements: CL-USER 9 > (make-array 0 :adjustable t :fill-pointer 0) #() CL-USER 10 > (vector-push-extend 'foobar *) 0 CL-USER 11 > ** #(FOOBAR)
An adjustable vector probably doesn't qualify as an "array" in the Java sense of the term: it's closer to an ArrayList. However Lisp is perfectly comfortable making zero-length simple-vectors, which are arrays in the Java sense.
> comfortable making zero-length simple-vectors
Btw., CL allows also zero-dimensional arrays:
CL-USER 3 > (make-array '())
#0ANILRe: Inside the JVM: Arrays and how they differ from other objects
#130Earlier quoted context omitted.
An adjustable vector probably doesn't qualify as an "array" in the Java sense of the term: it's closer to an ArrayList. However Lisp is perfectly comfortable making zero-length simple-vectors, which are arrays in the Java sense.
An ArrayList is not an Array? > comfortable making zero-length simple-vectors Btw., CL allows also zero-dimensional arrays: CL-USER 3 > (make-array '()) #0ANIL
Not in Java, no.
An ArrayList is an object which represents a variable length random-access list and does not support basic types (int, double etc.) An array is fixed-length and supports basic types. It is not an object per se.
The closest analog to an ArrayList in Lisp is an extensible vector, and the closest analog to an array is a simple-vector.
> Btw., CL allows also zero-dimensional arrays:
As any decent language would!