Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
sparkie
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
7 ms
·
31.
▲
by
sparkie
6mo ago
Reminder that the computer's endianness shouldn't matter. You should only care about the endianness of the streams your reading from and writing to. https://commandcenter.blogspot.com/2012/04/byte-order-f
32.
▲
by
sparkie
7mo ago
It double types each letter I type. Quite annoying.
33.
▲
by
sparkie
7mo ago
S-expressions are more like the tupled argument form, but better. (f x y z) Is equivalent to: (f . (x . (y . (z . ()))) Every function takes one argument - a list. Lists make partial application simpler than with tuples (a
34.
▲
by
sparkie
7mo ago
They have dozens of passes for semantic analysis and optimization, often configurable via flags, and they target dozens of different architectures.
35.
▲
by
sparkie
7mo ago
I'm not an academic and have extensive experience with parsing. But for whataver reason, VPAs have slipped under my radar until very recently - I only discovered them a few weeks ago and have been quite fascinated. Have been reading a
36.
▲
by
sparkie
7mo ago
(Properly formatted) XML can be parsed, and streamed, by a visibly-pushdown automaton[1][2]. "Visibly Pushdown Expressions"[3] can simplify parsing with a terse syntax styled after regular expressions, and there's an extensio
37.
▲
by
sparkie
7mo ago
That's not going to happen, but there's alternative research such as [1] where we get rid of the clock and use self-timed circuits. [1]: https://arc.cecs.pdx.edu/
38.
▲
by
sparkie
7mo ago
Advertisers will still pay, but they would need to adjust their strategy to target their ads more carefully to those who are likely to result in sales. For legitimate senders, the attached fee would end up being spent by the receiver to sen
39.
▲
by
sparkie
8mo ago
My luggage was missing when I landed at KIX. But it wasn't the airport's fault - my luggage was still in Amsterdam. Arrived <24 hours later and they delivered it to my hotel in Osaka.
40.
▲
by
sparkie
8mo ago
While the macro version doesn't permit this, if it were built-in syntax (as in C#) we can write something like: using (auto res1 = acquire1(); free(res1)) using (auto res2 = acquire2(); free(res2)) using (auto res3 = acqu
41.
▲
by
sparkie
8mo ago
This is how it would look with explicit labels and comefrom: puts("foo"); before_defer0: comefrom after_defer1; puts("bar"); after_defer0: comefrom before_defer0; puts("baz");
42.
▲
by
sparkie
8mo ago
Defer might be better than nothing, but it's still a poor solution. An obvious example of a better, structural solution is C#'s `using` blocks. using (var resource = acquire()) { } // implicit resource.Dispose
43.
▲
by
sparkie
8mo ago
Defer is a restricted form of COMEFROM with automatic labels. You COMEFROM the end of the next `defer` block in the same scope, or from the end of the function (before `return`) if there is no more `defer`. The order of execution of defer-b
44.
▲
by
sparkie
8mo ago
Compile using `-fkeep-inline-functions`.
45.
▲
by
sparkie
8mo ago
`inline` is a hint, but he declares `static_inline` in the preprocessor to include `__attribute__((__always_inline__))`, which is more than just a hint. However, even `always_inline` may be troublesome over translation units, though we can
46.
▲
by
sparkie
8mo ago
A subset of C could still use existing C compilers and get the optimizations. The front-end would just restrict what can be expressed in it.
47.
▲
by
sparkie
8mo ago
`uintptr_t` and `intptr_t` are integer types large enough to hold a pointer. They're not pointer types (They're also optional in the standard). In the first `my_func`, there is the possiblity that `a` and `b` are equal if their st
48.
▲
by
sparkie
8mo ago
> It probably is This was my point. It may be `unsigned long` on his machine (or any that use LP64), but that isn't what `uint64_t` means. `uint64_t` means a type that is 64-bits, whereas `unsigned long` is simply a type that is lar
49.
▲
by
sparkie
8mo ago
I was disappointed when MS discontinued Axum, which I found pleasant to use and thought the language based approach was nicer than a library based solution like Orleans. The Axum language had `domain` types, which could contain one or more
50.
▲
by
sparkie
8mo ago
SIMD is for performing parallel operations on many smaller types. It can help with some cryptography, but It doesn't necessarily help when performing single arithmetic operations on larger types. Though it does help when performing log
51.
▲
by
sparkie
8mo ago
> I would use std::uint64_t which guarantees a type of that size, provided it is supported. The comment on the typedef points out that the signature of intrinsics uses `unsigned long long`, though he incorrectly states that `uint64_t` is
52.
▲
by
sparkie
8mo ago
Cryptography would be one application. Many crypto libraries use an arbitrary size `bigint` type, but the algorithms typically use modular arithmetic on some fixed width types (128-bit, 256-bit, 512-bit, or some in-between like 384-bits). T
53.
▲
by
sparkie
9mo ago
> The biggest downside to this approach is we can't prevent the library user from using a struct initializer and creating an invalid structure (eg, length and actual string length not matching). It would be nice if there were some s
54.
▲
by
sparkie
9mo ago
Sometimes you want the struct to be defined in a header so it can be passed and returned by value rather than pointer. A technique I use is to leverage GCC's `poison` pragma to cause an error if attempting to access the struct's f
55.
▲
by
sparkie
10mo ago
Should really give the big-O notation for common operations for comparison of the approaches. --- There are some variations of Chunk/Bucket arrays which offer different characteristics. HAT (Hashed Array Trees[1]) are close to what is
56.
▲
by
sparkie
10mo ago
So we can't return the closure? Then it's clearly only half a solution. The example I gave above should work fine in any language with first-class closures.
57.
▲
by
sparkie
10mo ago
Thread locals don't fully solve the problem. They work well if you immediately call the closure, but what if you want to store the closure and call it later? #include <stdlib.h> #include <string.h> #include &l
58.
▲
by
sparkie
11mo ago
> x86 is unusual in mostly having a maximum of two operands per instruction[2] Perhaps interesting for those who aren't up to date, the recent APX extension allows 3-operand versions of most of the ALU instructions with a new data d
59.
▲
by
sparkie
11mo ago
It's due to the way the instruction is encoded. `lea` would've needed special treatment in syntax to remove the brackets. In `op reg1, reg2`, the two registers are encoded as 3 bits each the ModRM byte which follows the opcode. Ob
60.
▲
by
sparkie
11mo ago
This is why you should use Graphene's contact scopes and only allow access to contacts that you want to contact on WhatsApp.
More ›