Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
jcparkyn
searching Neon…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
7 ms
·
1.
▲
by
jcparkyn
3mo ago
Agent loops (particularly coding agents) have a huge amount of repetition, because the entire context is included in every model request. So long as it's at the start of the input and doesn't change, it will be able to hit the KV
2.
▲
by
jcparkyn
4mo ago
> If standard defined that left subexpression of addition is fully evaluated before the right expression that wouldn't be allowed. I'm no expert, but surely this would still be allowed so long as the compiler can prove that inc
3.
▲
by
jcparkyn
7mo ago
Honestly having looked at the memcached clients available for Java recently, I don't think any of the options could be considered feature-complete. None of the main ones support the meta protocol at all, meaning most of the advanced fe
4.
▲
by
jcparkyn
8mo ago
In the programs I write probably about 80-90% of variables are immutable, and I think this probably corresponds to most other code. Except in certain domains and programming styles, not that much stuff tends to need mutability. This is why
5.
▲
by
jcparkyn
8mo ago
This is a little bit tricky because the parser has to distinguish between: for x in arr (something ()) \ /-- function call and for x in arr (something ()) \ /-- loop
6.
▲
by
jcparkyn
8mo ago
This is similar but not quite the same as persistent data structures. In particular: - We can avoid quite a few allocations in loops by mutating lists/dicts in place if we hold an exclusive reference (and after the first mutation, we a
7.
▲
by
jcparkyn
8mo ago
> How to pass a mutable reference into a function, so that it can change the underlying value and the caller can observe these changes? Just modify the value inside the function and return it, then assign back. This is what the |= syntax
8.
▲
by
jcparkyn
8mo ago
This applies everywhere, and it fundamentally wouldn't be possible for just function calls. > needless cost Are you comparing to a language with mutable references or a our functional language? A language with mutable references wil
9.
▲
by
jcparkyn
8mo ago
Personally I think local mutability is quite a useful property, which was part of the inspiration for making this instead of just another pure functional language: - All functions are still referentially transparent, which means we get all
10.
▲
by
jcparkyn
8mo ago
> can you take the address of a variable in some way? I intentionally didn't add this, mostly because I wanted to explore how far you can get without it (and keep the language simple). Having a "real" pointer as a first cl
11.
▲
by
jcparkyn
8mo ago
Nope, it's value semantics (unlike Python), the references are just an internal optimization. Implicit copies happen when a list/dict with more than one reference is mutated.
12.
▲
by
jcparkyn
8mo ago
It's only semantically a pass-by-value, in reality a reference is passed and the data is only copied if needed (i.e. value is mutated while shared).
13.
▲
by
jcparkyn
8mo ago
> Have you benchmarked any real workloads? Nothing "real", just the synthetic benchmarks in the ./benchmarks dir. Unnecessary copies are definitely a risk, and there's certain code patterns that are much harder for my
14.
▲
by
jcparkyn
8mo ago
> Use immutable pass by reference. Make a copy only if mutability is requested in the thread. This is essentially what Herd does. It's only semantically a pass by value, but the same reference counting optimizations still apply. In
15.
▲
by
jcparkyn
8mo ago
Yes, if you modify a nested dict/list entry, all nodes above it will be cloned. Here's an example: x = [1, [2]]; var y = x; set y.[0] = 3; // clones the outer array, keeps a reference to inner array set y.[1].[
16.
▲
by
jcparkyn
8mo ago
Thanks, I updated the post title based on this and another comment. Thanks for the pointer to Euphoria too, looks like an interesting language with a lot of similar ideas.
17.
▲
by
jcparkyn
8mo ago
Not everything in C is pass-by-value. Sure, you can argue that a pointer itself is passed by value, but the data it points to is definitely not.
18.
▲
by
jcparkyn
8mo ago
I'm not sure if I understand the question? There are two ways to define a variable binding: x = 1; // declares x as immutable var y = 2; // declares y as mutable The "default" behaviour (if no
19.
▲
by
jcparkyn
8mo ago
Thanks, some interesting reading there that I will check out (I wasn't aware of PCF). Perhaps I should've used more precise wording: "All types are value types". > Standard ML [...] It has all you dream of and more Th
20.
▲
Show HN: A small programming language where everything is pass-by-value
(github.com)
91 points
by
jcparkyn
8mo ago
|
61 comments
21.
▲
by
jcparkyn
9mo ago
> The whole point of names is that they aren't descriptive I actually agree with this, but that's exactly the opposite of what TFA is arguing.
22.
▲
by
jcparkyn
11mo ago
One of my previous side projects used this idea in the extreme: It's a two-player online word game (scrabble with some twists) but all the state is stored in the URL so it doesn't need a backend. https://scrobburl.com&#
23.
▲
by
jcparkyn
1y ago
Not to mention tracepoints (logging breakpoints), which are functionally the same as printf but don't require compiling/restarting.
24.
▲
by
jcparkyn
2y ago
> I think if you [...] and have some luck you will succeed no matter what Ignoring the politics of it, this wording is pretty funny to me.
25.
▲
by
jcparkyn
2y ago
To be fair, this is the first thing that comes up when I google search for "DuPont connector" (after some sponsored shopping links).
26.
▲
by
jcparkyn
2y ago
Genuine question: Is it illegal to advertise for a product that doesn't exist, can't be bought, and you have no intention of taking money for?
27.
▲
by
jcparkyn
2y ago
> Conditionals are common enough that they can justify the indulgence I think there's another much more important factor that distinguishes conditionals from most other ternary operations (clamp, mix, FMA, etc): The "conditiona
28.
▲
by
jcparkyn
2y ago
Agreed, and then there's the time of check/time of use issue with creating a user. Probably not a vulnerability if userService is designed well, but still a bit dubious.
29.
▲
by
jcparkyn
2y ago
> squash an output into a range This isn't the primary purpose of the activation function, and in fact it's not even necessary. For example see ReLU (probably the most common activation function), leaky ReLU, or for a sillier e
30.
▲
by
jcparkyn
2y ago
> sorts and prints the latest results at a regular interval Slightly more complicated than that, because you can only sort and print elements once you have _all_ the elements that came before them. Once you add that layer you've got
More ›