« first day (4437 days earlier)      last day (408 days later) » 
00:00 - 19:0019:00 - 00:00

7:11 PM
$ time npm sart
Unknown command: "sart"

Did you mean this?
    npm start # Start a package

To see a list of supported npm commands, run:
  npm help

real    0m3.998s
user    0m0.216s
sys     0m0.369s
what part of that takes four seconds
 
@Seggan advanced Kotlin: return RabbitStruct(this, Context(parentContext, hashMapOf()).also { ctx -> ctx.putAll(this.fields.keys.zip(this.fields.values.filterIsInstance<Field<ResolvedInstantiatableType>>().map { ctx.ContextEntry(it.type.instantiate(ctx), it.mutability) } )) })
functional programming go brrrr
 
Literally every npm command is this slow
$ time npm --version
8.8.0

real    0m4.118s
user    0m0.121s
sys     0m0.416s
 
well, I just checked out the "projects that depend on this" tab on ktfmt's GitHub repository, and I saw this
what a coincidence
@Bbrk24 wow, even pip's faster than that:
ginger@gingerdrop:~/Rabbit$ time pip --version
pip 23.0.1 from /home/ginger/.local/lib/python3.10/site-packages/pip (python 3.10)

real    0m0.976s
user    0m0.622s
sys     0m0.091s
and pip's slow as frick
 
I switched to node 18 / npm 9.5 to see if it's any better and uh
$ time npm --version
9.5.0

real    0m28.644s
user    0m0.200s
sys     0m0.478s
 
28 seconds?!
wow
 
7:17 PM
Holy heck
 
that's appalling
 
Are you using Git Bash?
 
lemme try
 
Maybe try it on the "proper" Windows side?
 
Okay it turns out bash suspended it when I minimized the window :facepalm:
 
7:18 PM
lol
 
ginger@gingerdrop:~/Rabbit$ time node --version
v18.14.0

real    0m0.128s
user    0m0.003s
sys     0m0.024s
 
@Ginger Yeah same here. Node isn't slow, only npm
 
oh wrong command lmao
 
      ~  time npm --version                                                                                     ✔
8.12.1
npm --version  0.64s user 0.36s system 72% cpu 1.385 total
 
ginger@gingerdrop:~/Rabbit$ time npm --version
9.3.1

real    0m1.141s
user    0m0.603s
sys     0m0.117s
definitely suboptimal, but not "3 seconds" suboptimal
 
7:20 PM
One disadvantage of using a pretty prompt with Unicode symbols is that it gets messed up in non-Nerdfonts
1s is acceptable imo
 
imagine not using the normal Bash prompt
 
There's also the most useless error message ever, brought to you by MinGW's stupidity
$ node --version
v18.15.0

$ node --version >/dev/null
stdout is not a tty
 
Ah yes, the standard output is not an output
1984 be like
 
Why does it need a tty?
It's not interactive or anything
 
@user Because I called it node instead of node.exe, I kid you not
$ node.exe --version
v18.15.0

$ node.exe --version >/dev/null
 
7:21 PM
wut
 
MinGW. Not even once.
 
Does node point to something different from node.exe?
 
$ which node
/c/Users/bbrk2/.nvm/versions/node/v18.15.0/bin/node

$ which node.exe
/c/Users/bbrk2/.nvm/versions/node/v18.15.0/bin/node.exe

$ ls $(dirname $(which node))
CHANGELOG.md  corepack*          node.exe*              nodevars.bat  npx*
LICENSE       corepack.cmd       node_etw_provider.man  npm*          npx.cmd
README.md     install_tools.bat  node_modules/          npm.cmd
appears not
I wonder if npm.cmd is any faster than npm
Meh, not appreciably
 
@Ginger What's 1984 about this?
 
Also, here's an excerpt from npm v7's README:
> Installing on Cygwin

No.
 
7:55 PM
@RydwolfPrograms why should I use structraits over tradoop
 
1. Traits do what inheritence/interfaces do, but remove a lot of the weirdness, and add capability
2. Traits provide a great interface for operator overloading and custom behavior
3. You can implement traits onto existing objects, but in tradoop you can't make existing objects inherit from/implement something new
(Concrete example: Gave up trying to make a Fabric mod that made sand bonemeal-able)
4. You can decline to import a trait, or scope a trait, removing a lot of possible conflicts
5. Default implementations of traits (goes with #3), which are pretty versatile
6. The whole "everything is an object" mentality disappears, which is good, since it's kinda dumb in a lot of situations
7. You can statically dispatch things except when dynamic dispatch is absolutely required
 
in Rabbit traits are internally objects; the best of both worlds :b
 
@RydwolfPrograms as in rusts dyn?
 
I never liked that feature
i prefer just doing Trait instead of dyn Trait
 
8:02 PM
It's kinda necessary
 
how
 
Trait would be confusing and possibly ambiguous
Since it could just as reasonably (I'd argue more reasonably) mean impl Trait instead of dyn Trait
 
How
 
@RydwolfPrograms so, exactly what types should go into the error parameter of a Result? I've asked you this question before but I haven't really understood your answers
 
@Bbrk24 how does swift handle this?
 
8:04 PM
And thinking of traits as themselves being a sort of object is not the sort of thinking that should be encouraged
@Ginger Up to you. Rust's approach is the coder gets to decide. My idea is that it's an enum/union type built by the compiler.
 
@RydwolfPrograms not compiled, remember? but tell me more about your idea
 
*interpreter
So basically you can register an error type, which gets added as a variant of the global errortype enum
These would have scoped variant names
E.g., ErrorType::std::net::SocketClosed
 
🤮 rust package names /s
 
Except this wouldn't really be treated like a normal enum
 
wait, so your idea is that errors are members of an enum generated by the interpreter at runtime?
 
8:08 PM
@RydwolfPrograms imo traits are something that says “this struct can do that”
 
that's... weird
why's it an improvement?
 
you take something that can do something else
 
The complerpreter would keep track of what variants can exist in any instance of an error
@Seggan A struct is a noun. A trait is an adjective./
 
aaaaand you've lost me
I thought errors were enums, which can't have instances right?
 
I wouldn't go into a restaurant and ask for "one hearty" or order "one flavored" for dessert
@Ginger Wdym by "can't have instances"?
 
8:10 PM
@RydwolfPrograms related xkcd
@RydwolfPrograms Enums are singletons... right?
 
Well an enum isn't a thing
An enum variant is
 
w h a t
gah my mind must have been tainted by Python
 
Like...if I have a variable with the type ThingType and ThingType is an enum, that variable is an instance of ThingType
That's how I'm using the word "instance"
 
hmm ok
 
But yeah. Every variable/parameter which is "ErrorType" is actually a specific known subset of possible variants
(One of which is Ok/Success)
 
8:12 PM
I can see how that'd be an advantage
because that way every error is known at runtime
that's actually really clever
I will be using this system
 
One advantage is that it means you can force the program to handle each possible error type in, e.g., a switch/match
 
mfw my right arrow key is broken
 
And if, later, that function starts returning a new type of error, your code can't be compiled/start to be interpreted then panic later on when it receives an error it didn't know was possible
 
we call it abort around these parts but ok :p
oh, which brings me to another question: should aborts run cleanup code in using blocks?
 
The point of a panic/abort is that something really unexpected happened and you're getting out now
So no
 
8:15 PM
ok
hanging sockets go brrr
 
(Especially since when a process ends, things like used memory or open sockets/handles will typically be cleaned up anyway by the OS)
 
guess that rules out the NES as a compilation target, or it would were Rabbit compiled
I wonder, has anyone made a high-level lang that compiles to NES assembly?
that'd be cool
maybe even make it block-based q:
 
Important to note that, ideally, ErrorType would be able to include information in the enum variants, like Rust does
Regardless of how your language's normal enums work
That way you can store information specific to an error type
 
@RydwolfPrograms I can turn the argument around against dyn as well
 
Do it then
 
8:22 PM
You don’t say “I want something that is flavored” either
 
You do though, just with less weird adjectives
"I want something that is sweet"
If I don't know what dessert I want, for example
 
@Seggan You might if someone gives you plain sparkling water
 
But why can’t Trait mean that either
 
Because the "something that is" is important, since it could either be "anything that is, determined at runtime" or "something that is, which is known definitively"
 
I don’t see the difference between those 2
 
8:24 PM
impl Trait vs. dyn Trait
An impl Trait is a known thing that is that trait (or group of traits, as in impl X + y)
 
a static language is supposed to know whether something implements something else at compile time
 
For example, I can pass a ShihTzu in place of an impl Dog, and get a ShihTzu out
But if I pass it to a dyn Dog, it's now a dyn Dog
Because the function could instead return a GoldenRetriever
 
@RydwolfPrograms so janky generics?
 
An impl is known at compile time
I can't pass a dyn Dog in place of an impl Dog
@Seggan It's a shorthand for generics, yeah
 
… why not just do generics normally
 
8:27 PM
fn xyz(thing: impl Thing) is a shorthand for fn xyz<T: Thing>(thing: T)
It's just syntax sugar
But xyz(thing: Dog) could be confused with being that syntax sugar
 
But I won’t have that syntax sugar, so I’m fine
 
I guess, but again, it creates confusion to be able to use a trait in place of a data type
For people who are still trying to learn how traits work, it could be pretty misleading
 
It’s not using a trait, I’m thinking more like Java interfaces, where taking an interface means taking something that implements that interface
arg: Trait means something that implements that trait
 
I guess that is precendent for doing that, but I still think it would create unnecessary confusion just to save four keystrokes, and it would encourage doing something that should be a last resort out of laziness
E.g., why would I bother using the much longer generic syntax if I can just be lazy and use a dynamically dispatched Dog
 
See: Java
i have never seen anyone being confused by Java’s interface syntax
(I don’t mean the whole abstract class vs interface thing that confuses some ppl a lot)
 
8:36 PM
@RydwolfPrograms "Dynamically dispatched Dog" sounds like something straight out of a sci-fi novel.
 
 
2 hours later…
10:33 PM
6
Q: Inject arbitrary code into a compiler (robbers)

Rydwolf ProgramsThis is the robbers' challenge. To post a cop, go here. In this challenge, cops will invent a (likely simple) programming language, and write an interpreter, transpiler, or compiler that allows you to run it. Robbers will write a program in this language that manages to inject arbitrary code into...

15
Q: Inject arbitrary code into a compiler (cops)

Rydwolf ProgramsThis is the cops' challenge. To post a robber, go here. In this challenge, cops will invent a (likely simple) programming language, and write an interpreter, transpiler, or compiler that allows you to run it. Robbers will write a program in this language that manages to inject arbitrary code into...

9
Q: Tips for golfing in tinylisp

clismiquetinylisp is, in its essence, a very stripped-down version of Lisp, as the name suggests. It was made by @DLosc for an "interpret this language" challenge, which can be found here. It features a small amount of builtins, which can be used to create practically anything. There is a repository for ...

 
11:08 PM
@Ginger I was joking but honestly...Stack Overflow SSO might not be a bad idea
 
might do it
 
(one disadvantage being that moist programmers will have both GH and SO, and could forget which they used and make two accounts)
 
hm
maybe have a way to sign in with both at once?
 
*signs in sexily*
 
11:14 PM
Fun prac-lang idea:
proc main [
  temp ~ List<string> = "Hello, World!" -> to Characters
  temp -> makeString
  println ^
  println ^^^ -> makeString // same output
  end
]
 
What am I looking at
 
AAAAAAAAAAA
 
Just a fun little exercise on why I probably shouldn't make prac-langs
 
@lyxal Please tell me you won't do this to Vyxal
If you do I will jump out of my room's window (which is on the ground floor, but still, autodefenestration is not something I do every day)
 
Purely a concept
 
11:17 PM
Stop conceptualizing it
 
It's a fun concept
 
I don't know what it does and I don't want to know
(actually, I do want to know, how does it work?)
 
Basically what carets do here
 
I know what it does and I wish I didn't
 
The way you're using ~ and -> makes me feel uncomfortable
 
11:18 PM
but now I can't resist the urge to implement it
 
@RydwolfPrograms that's why I used them like that :p
 
Here are some other operator ideas: -# (the potato masher) {:} (Oscar), +-+ (barbell) !! (miscommunication at the eyebrow factory)
 
@user temp ~ List<string> = "Hello, World!" -> to Characters turns the string to a list of characters and stores it in temp, temp -> makeString does well what you would expect it to do, println ^ prints the result of the line above and println ^^^ -> makeString prints the result of calling makeString on the result of the line 3 lines above
 
I suspected that's what the ^ did
Please don't implement ^
 
do it
 
11:22 PM
The rest might be okay if you used different syntax but ^ is just cursed
 
that's the whole point
 
@user TI-BASIC Ans
 
Not a general-purpose lang
It's fine for calculators and the like, not for something that's non-interactive
(I'm assuming that's not an interactive REPL session lyxal posted, since it had proc main)
 
@Seggan Just saw this. Swift has two ways of error-handling: throw and Result. Result is typed better but throw has more syntax conveniences. Give me a moment to explain
 
@user it's a full program :p
 
11:27 PM
I'm adding this to Rabbit
best easter egg ever
oh, and I'll make the caret position matter too:
 
@lyxal Right, so ^/Ans/res/whatever isn't necessary, right? You can just assign to variables
@Ginger nonono
 
1 +   2
print ^
that'll print 2
 
@user but that doesn't make for as good a joke does it?
 
@Ginger So this will only work for number literals or variables?
 
verbose makina go brrr
@user nope
print("foo")
x = ^
x will equal the type of the print function
 
11:29 PM
@lyxal Language design is serious business, lyxal.
 
lies
 
@Ginger I hate it
 
@user I do a little
 
oh, and it gets better
 
Browse the language list here and you'll see that every language has a clear purpose and sane design decisions. No shenanigans whatsoever
 
11:30 PM
Does that mean that x is "foo" in this case?
 
No joking
 
print("foo")
x =     ^
 
yes
 
You know what, let the interpreter randomly decide
 
also:
 
11:30 PM
Because that's what humans do when met with an ambiguous sentence
 
print("foo")
print(     ^)
 
But it isn't ambiguous
@Ginger sigh
 
You can define it to let it be ambiguous :P
 
do you know what that prints?
 
I see where this is going
 
11:31 PM
that's right:
foo
)
 
no
 
HAHAHAHAAAA
 
what
 
beautiful
 
Why the )?
 
11:32 PM
It should print the value returned from the print("foo") statement
 
For just plain throw, you have this:
func foo() throws {
  // throws is untyped.
  // It can throw anything that adopts the Error protocol.
  throw MyCustomError()
}

func bar() throws {
  // To rethrow an error, use try with no catch:
  try foo()
}

func die() {
  // If you're confident that an error will never be thrown, you can use the
  // try! operator. If an error *is* thrown, the program crashes.
  try! foo()
}

func handleErr() {
  // If you want to explicitly handle the error, the syntax is a bit weird:
  do {
    try foo()
 
Okay, I see, it's because the caret points to the upper ). But shouldnt it be wrapped in ""?
 
no
 
@Bbrk24 So that throws in the function signature is like a half-baked version of Java's checked exceptions?
 
you see, if the caret points to a node that isn't a variable access or a literal it'll just return the raw character directly above it
 
11:33 PM
Result<T, U> is basically just Either<T, U> where U: Error, except that the Swift standard library doesn't have an Either type
@user Sorta. I prefer to think of it as the inverse of C++ noexcept
 
I guess this is less inconvenient than Java's way
 
Oh, and there's one more thing I forgot about: multiple catch blocks
 
Seggan, would you please convince Ginger not to add carets to Rabbit?
@Bbrk24 What about them?
 
Let me type
 
Sorry
 
11:35 PM
oh, and one last thing: they wrap
print(^) crashes with a recursion error
 
@user reading
@Bbrk24 I said that in the context of the trait conversation lol
 
@Ginger this is actually an interesting idea
 
struct MyError1: Error { var message: String }
enum MyError2: Error { case foo, bar(String), baz }

do {
  try throwingFunc()
} catch is MyError1 {
  print(error.message)
} catch MyError2.foo {
  print("foo happened")
} catch MyError2.bar(let str) {
  print("bar happened:", str)
} catch {
  print("Unexpected error", error)
}
 
I hate the concept, but if you're going to have it, wrapping makes it interesting
 
could be cool in a 2d lang
 
11:37 PM
yes this means code can be executed in an arbitrary order
 
practical 2d language
 
yes this will be a massive mess
 
lol
 
I would allow for some form of self-modifying code
 
catch is is certainly a way to spell that
 
11:38 PM
@Bbrk24 Yes my apologies for making you write that but we were talking about dyn and impl lol
 
Oh that
 
i was asking how swift handles that kind of stuff
 
In general, dyn Foo can't be an impl Foo for obvious reasons
but in Swift, dyn Error can be an impl Error (actually spelled any Error and some Error respectively)
the interface is just protocol Error: Sendable {}
 
Does impl do the same thing as it does in rust
 
Swift's any and some keywords are directly ripped from Rust's dyn and impl
some either makes a generic argument or an opaque return type
any makes an existential type
 
11:42 PM
Mhm
Mine is gonna get rid of the impl
 
In some cases you can omit the keyword any in Swift 5 (but this won't be allowed in Swift 6)
@Seggan I would rather write View<some View> than View<_ConditionalContent<Button<Text>, VStack<TupleView<(Text, Button<ZStack<TupleView<(Rectangle, Text)>>>, TextField)>>>>
That's not even an unreasonable example, I've had some abstract over types well over 300 characters long
 
@Bbrk24 no you can still write View<> like Java
a lot of the semantics of the lang are stolen from kotlin/java
 
The some View here is short for VStack<TupleView<(ModifiedContent<Button<Text>, { some internal type }>, Divider, _ConditionalContent<AnyView, List<Int, ForEach<[Int], Int, Text>>>, ModifiedContent<Button<Text>, { some internal type }>)>>. And that's way simpler than a real-world use case would be
I write { some internal type } because I don't know what type the .padding modifier actually uses
Anyways I have to go back to writing my paper (due in like four hours)
 
00:00 - 19:0019:00 - 00:00

« first day (4437 days earlier)      last day (408 days later) »