top 98 comments

sorted by: hot top controversial new old
[–] 102 points 5 months ago (5 children)

I bet the date wasn't in ISO 8601

  • source
  • hideshow 5 child comments
  • [–] 2 points 5 months ago (1 child)

    I got some files from a supplier last month date suffixed mmddyy, ex: concept1-250426

    I didn't even recognize it was a date stamp at first, until putting it alongside some earlier files from them with something like 190426

    what the fuck kind of nearly useless date stamp is that

  • source
  • parent
  • hideshow 1 child comment
  • [–] 41 points 5 months ago (5 children)
  • [–] 79 points 5 months ago (38 children)

    arrays don't have indices. lists have indices. arrays have offsets.

  • source
  • hideshow 38 child comments
  • [–] 19 points 5 months ago* (4 children)

    This is a language dependent semantic difference.

    I'll see myself out

  • source
  • parent
  • hideshow 4 child comments
  • [–] 8 points 5 months ago (3 children)

    hey no you can't logic your way out of this! i wanted an argument!

  • source
  • parent
  • hideshow 3 child comments
  • [–] 17 points 5 months ago (1 child)

    §6.7.9 of the C11 standard says they have elements with indices:

    If an array of unknown size is initialized, its size is determined by the largest indexed element with an explicit initializer. The array type is completed at the end of its initializer list.

  • source
  • parent
  • hideshow 1 child comment
  • [–] 6 points 5 months ago

    it also states in section 6.7.7 ("type names") that

    If the pointer operand points to an element of an array object, and the array is large enough, the result points to an element offset from the original element such that the difference of the subscripts of the resulting and original array elements equals the integer expression.

    note also that your example is the only occurrence of the word "index" in the entire document that isn't just referring to the actual index at the end.

  • source
  • parent
  • [–] 4 points 5 months ago (7 children)

    Says who?

    By definition, an index is

    a number or symbol or expression (such as an exponent) associated with another to indicate a mathematical operation to be performed or to indicate use or position in an arrangement

    Since the arrays offsets alao tell us about the items’s position in the array, is it not then an index?

    People take these terms way too seriously. Hell, many languages have their “list” implemented as an array. What then do you call the index/offset?

  • source
  • parent
  • hideshow 7 child comments
  • [–] 1 point 5 months ago* (6 children)

    if you want my opinion (<- see now you can't tell me i'm wrong, it's an opinion) then the difference is that an array is by definition a memory address that's designated as the beginning of an array, and it's got an offset because the first element is at that specific address and further items are offset from that address. so you add the offset to the address to get the nth item. a list, meanwhile, can be basically any implementation under the hood, but it's commonly a linked list. the way you get the nth index there is you count up from the first position. since the implementation is opaque and may be spread out in memory you can't arithmetic your way to an index, you need to follow the pointers.

    java's arraylist is a list backed by an array. java's vector is a list backed by a linked list.

  • source
  • parent
  • hideshow 6 child comments
  • [–] 3 points 5 months ago (5 children)

    That doesn’t really address what you call it. Names only really just exist to get your point across. Inexperienced devs may not know what an offset means (or why we use that), so index does the job. An experience dev knows how it works anyway, so whether you say index or offset won’t matter. By virtue of the common denominator, I simply use index everywhere.

  • source
  • parent
  • hideshow 5 child comments
  • [–] 1 point 5 months ago (4 children)

    depends on the area you're working in. it's a pretty important distinction in embedded software.

  • source
  • parent
  • hideshow 4 child comments
  • [–] 3 points 5 months ago (3 children)

    Why? I’ve worked as an embedded dev for a few years and nobody in my team cared what it was called.

  • source
  • parent
  • hideshow 3 child comments
  • [–] 1 point 5 months ago (2 children)

    because making sure offsets are correct come up a lot when you're memory-mapping IO.

  • source
  • parent
  • hideshow 2 child comments
  • [–] 1 point 5 months ago (15 children)
  • [–] 4 points 5 months ago (14 children)

    javascript doesn't have arrays. the backing data structure is a doubly-linked list.

  • source
  • parent
  • hideshow 14 child comments
  • [–] 6 points 5 months ago (12 children)

    and the backing for that is linear or page addressed MOS transistors, spinning rust or flippy-round magnets.

    do you have a source that indicates mainstream JS engines internally uses a list structure for arrays? I can't find one.

  • source
  • parent
  • hideshow 12 child comments
  • [–] 4 points 5 months ago (11 children)

    skipped a few steps there i think.

    anyway, good question. led me to some cursed code.

    the ArrayObject in spidermonkey is an interface to either a TypedArrayObject or a SharedArrayObject. those both have an inner ArrayBuffer object, which is a view into ArrayBufferObjectMaybeShared, which contains a refcounted vector of uint8 pointers, regardless of the datatype. soooo all arrays in javascript are... strings?

  • source
  • parent
  • hideshow 11 child comments
  • [–] 2 points 5 months ago (1 child)

    skipped a few steps there i think.

    thanks for the considered reply. didn't mean to jump all the way down to electrons and sound so flippant.

    my claim is that JavaScript arrays are arrays because the spec defines their behavior as such. the implementation details are absolutely interesting from a performance perspective and I was genuinely curious how an internally linked list implementation would actually work, real-world. regardless... almost every interaction I have ever had with a JS programmer has ended in "its strings all the way down".. so... I mean... yes-ish?

    loved your poking of the hornets nest in this thread :-)

  • source
  • parent
  • hideshow 1 child comment
  • [–] 3 points 5 months ago

    i was thinking between the linked list and the transistors :)

    also, i mean... what you might call an array i might call a vector. js arrays allow elements of different types, so they are by definition not arrays in the traditional sense. them being chars internally does make sense in a gross way.

  • source
  • parent
  • [–] 2 points 5 months ago (5 children)

    That's a different kind of array (Float32Array etc.), not the "normal" kind.

  • source
  • parent
  • hideshow 5 child comments
  • [–] 2 points 5 months ago (4 children)

    i couldn't actually find any of that in spidermonkey. i was looking in js/vm/arrayobject and its parents, didn't see any others.

  • source
  • parent
  • hideshow 4 child comments
  • [–] 1 point 5 months ago (3 children)
  • [–] 1 point 5 months ago* (2 children)

    i did look at that but i started out here: https://searchfox.org/firefox-main/source/js/src/vm/ArrayObject.h because it inherits from NativeObject.

  • source
  • parent
  • hideshow 2 child comments
  • [–] 1 point 5 months ago (2 children)

    If I'm understanding you correctly, they're basically doing the same thing as Python under the hood and using a heap-allocated array (vector) of pointers? If so, that should still be orders of magnitude faster than a linked list.

    If their implementation is actually a linked list, colour me shocked. My impression was that JavaScript is "decently fast". I've never even considered writing high-performance code in it, but I've heard that the compiler can optimise extremely aggressively, and it's used so widely that I couldn't imagine that it had glaring performance issues like what I would expect to see if every array was actually a linked list under the hood.

  • source
  • parent
  • hideshow 2 child comments
  • [–] 1 point 5 months ago (1 child)

    can't a jit move things around enough that a linked list could be transformed into a memory-backed array if the access pattern requires it.

  • source
  • parent
  • hideshow 1 child comment
  • [–] 1 point 5 months ago

    Sure it can, as long as it retains behaviour according to whatever standard it needs to comply to. My point was rather that I would be very surprised if the actual implementation (at memory level) was a linked list.

  • source
  • parent
  • [–] 17 points 5 months ago (5 children)
  • [–] 6 points 5 months ago (4 children)
  • [–] 4 points 5 months ago (3 children)
  • [–] 13 points 5 months ago
    [–] 13 points 5 months ago*

    There is no second date because YYYY-MM-DD'T'HH:ii:ss'Z' is the only acceptable date.

  • source
  • [–] 10 points 5 months ago (1 child)

    R wins again! I'm grateful every time i write the vector 1:n

  • source
  • hideshow 1 child comment
  • [–] 9 points 5 months ago (3 children)

    Not in MATLAB/Julia! (But like yes under the hood computers start at 0)

  • source
  • hideshow 3 child comments
  • [–] 12 points 5 months ago (7 children)

    Unless you're programming in VBA. But at that point you're already fucked anyway.

  • source
  • hideshow 7 child comments
  • [–] 2 points 5 months ago (2 children)
  • [–] 1 point 5 months ago (1 child)
  • [–] 2 points 5 months ago

    My suggestion for people who want to get into developing for Dynamics 365 F&O and X++:

    Don't.

    spoilerAlthough I will admit that with the limited number of D365 devs out there, you can probably get some good work. Just ... you have to jump through some hoops to be able to tinker with it, since it's MS's big ERP system.

  • source
  • parent
  • [–] 1 point 5 months ago* (last edited 5 months ago) (1 child)

    VBA arrays start at 0, unless you explicitly set it to start at 1.

  • source
  • parent
  • hideshow 1 child comment
  • Technically, VBA arrays start wherever you want them to and end wherever you want them to. Thing is, since VBA is usually interfacing with MS Office, you're heavily dependent on what the office APIs do. And unfortunately, they very often start counting with 1. So practically, you're generally starting your counting with 1.

  • source
  • parent
  • [–] 6 points 5 months ago

    Let's meet in middle and start it at 0.5

  • source
  • [–] 19 points 5 months ago (13 children)

    Djikstra was so fucking wrong with this and people who parrot this are so annoying.

    Sure, an offset starts at zero, but an index can very well start at one. Not all arrays represent a physical offset, please stop pretending your inferior zero only indexing is in any way superior.

    Sometimes math is just simpler from one. When you’re translating math to code, one based indexes are usually better.

  • source
  • hideshow 13 child comments
  • [–] 13 points 5 months ago (6 children)

    If your math uses numbers it's not real math.

  • source
  • parent
  • hideshow 6 child comments
  • [–] 4 points 5 months ago (5 children)

    Technically Real math only uses numbers.

  • source
  • parent
  • hideshow 5 child comments
  • [–] 5 points 5 months ago (4 children)
  • [–] 3 points 5 months ago (3 children)

    I believe it was a joke where real maths refer to maths dealing with real numbers.

  • source
  • parent
  • hideshow 3 child comments
  • [–] 1 point 5 months ago (2 children)

    Fuck the real numbers. Numbers are an abstraction.

    Zero is a "real" number. Negative 5 is a "real" number. But have you ever seen zero apples or sailed on negative 5 boats? Uh uh no you haven't. They are not real.

    In reality there's only existence or nonexistence, it could be a thing or it could not be anything at all, though the latter is actually impossible. All other things are then not the same as that. If you line them up you can make statements like this thing is not that thing. This is basically the succession function, and we're already ahead of ourselves.

    From there on we can start inventing more abstractions by using Peanos axioms, but it's all abstractions, because the second axiom state that something is the same as something, and nothing in reality is ever the same as something else.

    It's all made up. Reality does not have numbers at all.

  • source
  • parent
  • hideshow 2 child comments
  • [–] 2 points 5 months ago (1 child)

    I've heard people argue in both sides of "is 0 a natural number?". But I've never before encountered the "there are no natural numbers" argument. It's like flipping a coin and having it land sidewise.

  • source
  • parent
  • hideshow 1 child comment
  • [–] 1 point 5 months ago

    Yeah sorry I am a sideways coin when I get bored.

    It would be great if say .. two atoms .. were the same, so we could say that these are the same and that this is the definition of 1 and start counting and so on, but they're just not. It's fractals all the way down and up. The entirety of math requires an abstract definition that segments things to be the same like a pixelated resolution of reality. It only exists as an idea.

  • source
  • parent
  • [–] 5 points 5 months ago* (last edited 5 months ago) (2 children)

    I shall not lower myself to use the newfangled Mathematical inventions of the Arabs and instead keep doing Mathematics like the Romans!

  • source
  • parent
  • hideshow 2 child comments
  • [–] 5 points 5 months ago (2 children)

    Two Gyllenhaal back to back?

  • source
  • hideshow 2 child comments
  • [–] 5 points 5 months ago

    You dodged a bullet, my friend.

  • source
  • [–] 5 points 5 months ago

    she forgot and is already getting her guts rearranged by Chad Thundercock 10.5"

  • source
  • [–] 2 points 5 months ago (2 children)

    The picture in meme made me think like it's a europenized version of Kazuma Kiryu, who is conviniently a long-time friend with Makoto Date.

  • source
  • hideshow 2 child comments
  • [–] 2 points 5 months ago

    this one hurts...

  • source
  • [–] 3 points 5 months ago* (last edited 5 months ago)

    Come at me like that and I'll know you are still a boy.

  • source
  • load more comments
    view more: next ›