« first day (4433 days earlier)      last day (414 days later) » 

12:13 AM
> TypeError: Cannot read properties of undefined (reading 'stackSave')
mfw the autogenerated glue code is broken
 
Also, my postMessage calls from within the worker seem to be going nowhere -- the window.onmessage handler isn't receiving them
 
worker.onmessage
not window.onmessage
 
oh
Also I know why the glue code broke: It tried to call the wasm before it was done setting up
It works!
 
12:35 AM
đź‘Ź
 
There's a weird visual glitch but I'm pretty sure that's a CSS mistake and not anything to do with the JS/wasm
 
1:00 AM
Sandbox posts last active a week ago: Great Leap to the Right
 
1:48 AM
how did i just get an upvote literally 2 seconds after posting an answer
 
What's wrong
 
> Annoyingly, longer than Java.
 
@l4m2 its too fast
bot maybe?
@Bbrk24 yes, i am very mad at that
kotlin is never longer than java in code golf
 
I'd say reasonable
 
2 seconds?
 
1:54 AM
Maybe the question asker was staring down their inbox
 
Some users upvote e.g. first answer, and I sometimes upvote first and if it's bad I unupvote
 
1
A: What's missing (aka the vanilla multiset difference challenge)

Olivier GrégoireJava (JDK), 21 bytes a->b->a.sum()-b.sum() Try it online!

I doubt kotlin can beat that
 
One thing I don't like about SE is that you can't remove an upvote after five minutes. Sometimes I'll upvote an answer and then realize it doesn't work half an hour later
 
@emanresuA ok, kotlin loses by 1 byte. and its only because kotlin needs curly braces around lambdas
usually it beats java
1
Q: Must a wavefunction be normalisable for a pdf to exist?

mjcMy course notes say, for normalised wave functions $\psi(x,t)$, the function $$\rho(x,t)=|\psi(x,t)|^2=\overline{\psi(x,t)}\psi(x,t)$$ gives the $\color{red}{\text{probability density}}$ for the position of the particle. I guessed from the bold that something about this is specific to normalise...

yes, because PDFs exist
they are the bane of document editing
if i had a time machine, id prevent them from being invented
idk how many times my teacher gives an assignment and its a pdf and i cant edit it so i have to print it write on it by hand and scan it back in
 
surely you mean no, because otherwise the existence of pdfs would imply that all wavefunctions are normalizable
 
2:08 AM
Fun fact: before iOS 13, the only way you could embed vector graphics in a native iOS app was by making them PDFs. Otherwise you had to use a PNG or JPG. If you added an SVG, it would be converted to a PNG.
4
 
@Seggan it was me :D
 
how lol
 
@Bbrk24 WHAT
 
Yeah. iOS development is great
Today in "typos that work for some reason": git fetch --al
-al doesn't work. I guess it just recognizes --al as an alias for --all?
 
 
2 hours later…
4:29 AM
I found this useless-looking (but presumably needed) piece of JS code: ~~+Math.ceil((R-+(~~R>>>0))/4294967296)>>>0
 
> In summary, this code snippet converts a given numeric value R to a 32-bit unsigned integer.
from chatgpt
 
Except that if R=200, it spits out 0
 
 
@Bbrk24 interesting
no reason for it to produce 0
 
4:34 AM
~~R>>>0 DOES an unsigned integer make
 
R-+(~~R>>>0) is going to be 0 if the input is already a 32-bit uint
 
If you want it to be a 32 bit integer, I'd suggest ((~~R)&0xFFFFFFFF)>>>0
 
Again, I didn't write this code. I found it (in a minified JS file)
 
Ah
 
Oh! I know what this is! It might be to find the high dword of a 64-bit number
 
4:36 AM
Ah, that seems to be it.
 
@lyxal Note the parens, the R-+... happens before the .../4294967296
 
In testing it definitely does taht
 
 
3 hours later…
7:43 AM
come to think of it why are both ~~ and >>>0 necessary
since they both should do nothing on an integer, shouldn't they both just function as coercions
 
 
3 hours later…
10:57 AM
@UnrelatedString Some operations convert something to a 32-bit signed int, others to a 32-bit unsigned int, and others to just any integral value (even if it’s stored as a double). I assume they’re intentionally mixing the three
 
12:23 PM
time to bash my head against the Rabbit combined-type-resolver-and-importer machinery
like seriously I hate this
because of how I've done it I have to handle local file imports differently even though their import declarations aren't different
so I have to do lots of jank to figure out which imports are local, and then even more jank to initialize them in the correct order
there's gotta be a better way to do this
 
 
3 hours later…
3:35 PM
@Seggan exciting progress has been made
 
noice
i feel like working on rol but i wanna work on cgr more
 
I've ended up having to run the type checker and resolver on individual files in a module due to... reasons, but it should be fine
 
@Seggan code golf romance?
 

CGR

Mar 14 at 19:34, 52 minutes total – 80 messages, 6 users, 0 stars

Bookmarked Mar 14 at 23:06 by Seggan

me, user, and bbrk are building it
@mathscat stands for common golfing runtime
 
4:01 PM
@Seggan so, uh, things happened
and I now have 11 different classes for imports, including 4 abstract ones
 
what
i have exactly 0
as in 11 classes the represent imports or 11 classes for handling import resolution?
 
4:57 PM
@Seggan 11 classes representing imports
 
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
why
 
I might prefer node’s entire mess (two separate import systems) over that
 
@Bbrk24 lemme clarify: this is an implementation detail
to the end user it just looks like one import system, as it should
 
It sounds easier to make a require/module.exports system than that
 
it is
 
5:10 PM
I’m morbidly curious, why/how is it so complicated?
 
lemme type :p
@Seggan there are 3 types of imports: unresolved, resolved local, and resolved nonlocal, which each have 2 subtypes: normal and from
 
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
 
the other 6 classes are abstract ones
 
mine is just Map<String, Set<String>>
 
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
 
5:12 PM
the first string is the package, second is the stuff imported from that package
 
that's worse somehow
also, you don't have to interpret your language
I do
also also your import system is quite different from mine
 
@Ginger why
 
why in the name of frick are you just passing raw strings around
oh, right, you don't have to interpret anything
 
5:27 PM
@Bbrk24 ive specified the binary format exactly
 
@mousetail LOL, that's amazing. ^_^
 
@Seggan Thanks. The code looked good, I just didn't want to approve it until I was certain on how it worked
 
5:54 PM
@Bbrk24 yeah one thing is missing from the pr tho... the magic number 0xDEADC0DE
 
I remember one time I got an error because my wasm file began with '<!DO' rather than '\0asm'. I'm still not sure how that happened
 
Inline Latex not work!
 
On codegolf.stackexchange you have to put backslashes before the dollar signs
\$this\$ rather than $this$
 
Yeah i do this but not works!
 
it doesnt work in chat either unless youve got the chatjax userscript
 
6:00 PM
No, in the main site, in the question body!
 
Can you link to the broken question?
 
@Seggan shouldn't ConcreteType also have a field for the members of the class it refers to?
 
only screenshot
 
@Ginger why, if i can do just whatever.superclass.members
 
whar ?
@Seggan superclass is a ConcreteType, no?
 
6:07 PM
yes
and i can access its members too
 
with what property
ConcreteType has no members property
 
it doesnt?
im quite sure i added a fields or smth similar
 
Is your local copy different from the one on GH?
 
it shouldnt be for that class
 
6:25 PM
@Seggan is it in the classes branch?
 
6:55 PM
maybe
 
7:09 PM
@Seggan doesn't look like it :/
 
huh
nvm then
 
does your local copy have it?
 
cant check
 
mfw
 
@Seggan since when are 0xDEAD and 0xC0DE one byte each? :P
I already left a comment on Github, but I'm curious to hear the logic (or lack thereof)
 
7:14 PM
since my head invented the 16 bit byte :P
 
Oh here's a neat thing: The ... operator in Swift allows you to omit one or, for some reason, both, of the bounds. Instead of slicing over 4 ..< count, you can just slice over 4....
I'm not entirely sure what the purpose of the niladic ... operator is, but you can use it to take a slice that is the entire array
 
apparently its not going to be breaking
unlike when other langs use a new major version
 
Swift 4 -> Swift 5 was barely breaking. Off the top of my head, the only breaking change was that they reworked how you implement custom string interpolations. Swift 5 -> Swift 6 will be source-breaking but not binary-breaking, interestingly enough
there's also some langs that can't do source breaks, like JS and C
 
7:40 PM
JavaScript 2: Even More Cursed™
 
@Bbrk24 array.slice() in JavaScript is used to make a shallow copy of the array. Would that make sense in Swift?
 
or python array[:]
 
No, in Swift a slice of an array points to the same underlying buffer. It's CoW
 
Copy on Write?
 
yeah
All the standard collection types (String, Array, Dictionary, Set) are CoW
 
7:43 PM
Interesting. So if you assign a slice to a new variable, you can read from that variable without actually modifying anything, but as soon as you modify one of the elements, it makes a copy and modifies that?
 
Yes
I'm not 100% sure about arrays, but at least for strings, retaining a slice retains the entire underlying buffer, even if the slice is only a couple characters in a several-kB string
Knowing how malloc works, the same is probably true for arrays
The only thing I can think of is that slices are different types from the underlying collection (ArraySlice and Substring from Array and String respectively), but you can just say Substring(str) to convert it
 
is it copy on first write or copy on write in general?
 
CoW implies RC (reference counted). When a CoW type is mutated, it first checks whether refcount == 1, and if not it makes a copy.
 
huh
 
Swift uses refcounting pretty universally -- it doesn't have Java-style GC.
 
7:59 PM
me when annotation parameter type restrictions
 
8:28 PM
new Rabbit thing: The standard package-naming convention shall be author.package
so for example the built-in system module would be rabbit.system
oh, also: I really like Kotlin's trailing-lambda syntax, so I will be yoinking it
I will also be yoinking the let and also functions, except I will be renaming them to apply and with respectively
(@Seggan)
 
eek
(also -> with makes sense, but why let -> apply?)
 
because you're applying code to whatever you're calling it on
hmm actually that doesn't make much sense :b
but let makes even less sense
 
Swift has some really cool trailing lambda syntax that's I believe a superset of Kotlin's
 
In the Java world, at least f.apply(args*) means f(args*), more or less
@Ginger Yeah let isn't the best name
 
@user the java world is not what I come from
 
8:32 PM
Let's say that a function f has labelled arguments foo:, bar:, and baz:, in that order. You can say f { /* foo */ } bar: { /* ... */ } baz: { /* ... */ }
 
brb, will think up better names
 
@Ginger Right, just pointing out how it could be confusing
@Bbrk24 That looks hard to parse, though (for a human)
 
With the right whitespace it's fine
Button {
    print("clicked!")
} label: {
    Text("Click me!")
}
 
Ooh I do kinda like that
Perhaps I should become a Swiftie myself
 
Especially when the alternative is
Button(action: { print("clicked!") }) {
    Text("Click me!")
}
 
8:34 PM
eek
 
@user It's painful to use on anything other than macOS, ime, so I don't use it anymore
 
A builder wouldn't be terrible
@Bbrk24 Apple >:(
 
@user Oh, let me teach you about @resultBuilder
// Before @resultBuilder:
var builder = Builder()
builder.addInt(3)
builder.addString("hi")
let result = builder.build()

// After @resultBuilder:
@Builder var builder = {
  3
  "hi"
}
let result = builder()
Apple built an entire declarative UI framework out of this, and it is amazing (or at least better than UIKit)
 
Nice
 
9:20 PM
Is 19:55 the time on a 24 hour clock with the largest sum of digits?
 
23:55?
 
19:59, surely?
 
ah yes
wait no
23:59
 
1+9 > 2+3
 
1+9 > 2+3??
 
9:24 PM
Thus 19:59
 
@pxeger sry, brain waint working
 
10:08 PM
here is a complete hello world program in CGR:
0000: de ad c0 de 03 a5 50 52 49 4e 54 a4 4c 4f 41 44   ......PRINT.LOAD
0010: a6 53 54 52 49 4e 47 01 00 ad 48 65 6c 6c 6f 2c   .STRING...Hello,
0020: 20 57 6f 72 6c 64 21 02 01 00 00                   World!....
 
Unicode strings when
 
already supported
the hexdumper likes ascii
 
Ah are you using utf8
 
Does the CGR need a byte serialisation / syntax? Can't it just have a structured API?
 
@emanresuA Yeah, msgpack uses UTF-8
@Seggan I'm assuming you have local changes you haven't pushed, because the only opcode I see is NOP
 
10:18 PM
i havent added those opcodes either (yet) :P
this was a manually built file
@pxeger both
 
I mean I figured the file was handwritten
 
the actual program is the last 3 bytes
 
Why are the opcodes indices in the string pool instead of a predefined list of bytes?
 
it ends up being LOAD 0 (Hello, World!); PRINT
@Bbrk24 because of the extensibility
we cant have conflicting byte ids
ive had to suffer though byte id hell when writing certain minecraft plugins
until the parent plugin switched to string ids, much easier
 
fair enough
 
10:22 PM
@pxeger the problem is making the api the same across the language barrier (say i write a lang in python, but the interpreter is jvm). that requires some cross language format
 
Benefit to me making overflow unspecified in Trilangle: the compiler for CGR can use a 32-bit int instead of a 24-bit one
 
well actually the number type is an arbitrary precision complex number
you can still treat it as reals ofc
 
I thought there was three types (Int, Dec, Complex)?
Or is Int only for e.g. load instructions and not arithmetic
Really the only instruction where it matters is DIV
 
@Seggan Easy solution to that: tell the Python person to suck it
3
 
suck it yourself you coward
 
10:37 PM
Ouch.
 
@Seggan A painful past...
 
@Bbrk24 int is for that yes
@Bbrk24 Dec is a building block for Complex
 
Then why can you put a Dec in the constant pool?
 
for building complexii
well, technically, you can put anything on the stack
but the operators will only operate on Complex
 
10:52 PM
I'm just trying to think of what you can do with a Dec
 
nothing you cant with a Complex
i intended Dec to be used internally, like for construction of complexii, printing, and such
 
No I get that. I'm just confused as to what you can do with a Dec from the constant pool
 
construct a Complex
see the BaseLabel code for COMPLEX
 
Oh! Somehow I overlooked the fact that it unpacks Complex as two indices and not two strings
I just thought of a potential problem with that but give me a moment to construct the actual bytecode
@Seggan why are we using a number followed by loose objects rather than msgpack arrays? Does the unpacker not support unpacking arrays?
 
11:13 PM
ive tried, its very wonky working with unknown typed arrays
 
Got it
As for the problem I mentioned earlier: here's two different bytecodes that attempt to construct the complex value 0+0i

Invalid:
dead c0de 02a7 434f 4d50 4c45 58a7 4445
4349 4d41 4c02 0001 0101 a130

i.e. (deadc0de, 2, ("COMPLEX", "DECIMAL"), 2, ((0, (1, 1)), (1, "0")))

Valid:
dead c0de 02a7 434f 4d50 4c45 58a7 4445
4349 4d41 4c02 01a1 3000 0000

i.e. (deadc0de, 2, ("COMPLEX", "DECIMAL"), 2, ((1, "0"), (0, (0, 0))))
Is that analysis correct? I think the first one is invalid because constantPool[0] references constantPool[1]
 
yeah you can only reference earlier entries
 
As long as that's intentional, I have no issue with it
 
i think a ZERO opcode (like ICONST_0 in java) would be nice
 
Kotlin's implementation of Long in JS has hardcoded const val ZERO, const val ONE, and const val MINUS_ONE or something like that
I feel like an int-to-complex opcode would be helpful for, if nothing else, shrinking the constant pool
 
11:40 PM
mhm
thing is, primitives are gonna be boxed on the jvm
 
Also, you changed the line where you check the magic number, but not the line below it where you slice the buffer
 
oop
my brain is not working today
 

« first day (4433 days earlier)      last day (414 days later) »