Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
gsg
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
22 ms
·
151.
▲
by
gsg
12y ago
I have this, and I second the recommendation: it's a fantastic text.
152.
▲
by
gsg
12y ago
> For arrays of whatever, it may be internally transformed into the same contiguous representation you see in C. This is a bit tricky because Java and C semantics are not the same, and an optimizer is obliged to prove that the difference
153.
▲
by
gsg
12y ago
It could just be a movd if the compiler backend people put the work in (and if they can't be arsed and implement it as a function call, that's nothing to do with the type system).
154.
▲
by
gsg
12y ago
What's the difficulty, exactly? You need some mundane float->bits and bits->float operations, which are commonly although not universally provided in strongly typed environments. The rest is integer ops.
155.
▲
by
gsg
12y ago
Unfortunately the OCaml toplevel pales in comparison to CL environments like slime in terms of visibility and debuggability. Redefinition is also off the table, as OCaml is a very static language. (You can rebind the same name, which can be
156.
▲
by
gsg
12y ago
That's not the whole story. There are other costs associated with calls such as spilling and imprecision of data flow analyses around a call site.
157.
▲
by
gsg
12y ago
Hints are useless, but arranging for cold code to be on a forward branch can be beneficial.
158.
▲
by
gsg
12y ago
http://docs.racket-lang.org/ts-guide/types.html?q=typed#%28p... Right, looks very similar.
159.
▲
by
gsg
12y ago
It's not hard to imagine an extension to ML-style types that could cover variadicity: map : ('a... -> 'b) -> ('a list)... -> 'b list Where <type>... denotes <type1> -> <type2>
160.
▲
by
gsg
12y ago
I was referring to the PIC-specific 0x0(%rip) construct as well as the relocation. Sorry if that was unclear.
161.
▲
by
gsg
12y ago
More or less, yeah. You would still need to use RIP-relative addressing since that is how PIC functions, but you could have nice symbolic addresses. objdump is a very simple tool. If you want more featureful disassembly tools you should pro
162.
▲
by
gsg
12y ago
By the way, I believe the zeros are addends and not actually dummy values. This is a bit strange because ELF has existing provisions for relocations with addends, but there it is.
163.
▲
by
gsg
12y ago
Those are just ordinary relocations in PI code. You'll see this kind of information if you run, say, objdump -rd foo.o on a x86-64 object file that has been compiled as PIC. Note that your code fragment is not PIC, so it would not su
164.
▲
by
gsg
12y ago
It's not relative vs absolute, no. Jumps and call instructions have been using PC-relative values right from the start. You might be thinking of RIP-relative addressing, which is useful in PIC to access globals. The problem is that the
165.
▲
by
gsg
12y ago
Because the function doesn't have anywhere to jump to. Instead it generates zero-or-one from the overflow flag (with seto) and the caller will then do something like test eax, eax/jnz handle_overflow. In other words, the abstracti
166.
▲
by
gsg
12y ago
Note that MLton compiles a language which requires int arithmetic to raise an exception on overflow, the overhead of which provides a strong motivation for such analyses.
167.
▲
by
gsg
13y ago
That's not due to transitivity: ['0'] == ['0'] (and for that matter, ['0'] === ['0']) is also false. These operators compare objects for identity, not structural equality.
168.
▲
by
gsg
13y ago
You can do it, although at a considerable performance hit. The usual approach is "fat" pointers that include bounds information. Memory safe pointer arithmetic is achieved by checking that any constructed pointer lies within those
169.
▲
by
gsg
13y ago
C++ does not have a reasonable memory safe subset. No, smart pointers do not provide real memory safety.
170.
▲
by
gsg
13y ago
"Our program will preallocate 1000 bytes on stack for variables, since all of our variables are static." Oof, talk about cutting corners. Works well enough until you need function calls, I guess. Anybody who finds this intriguing
171.
▲
by
gsg
13y ago
I see. Sorry, I should have interpreted that more generously.
172.
▲
by
gsg
13y ago
> Of course, it's also more limited in how it interacts with the corresponding values. This is backwards. Polymorphic values without constraints admit almost no operations at all - you can "copy" them, that's it. This
173.
▲
by
gsg
13y ago
Wait. What the hell is a "plumicorn"? "An ear tuft of feathers, as in the horned owls." I... didn't realise there was a word for that.
174.
▲
by
gsg
13y ago
In terms of compiler design, Graal/Truffle springs to mind.
175.
▲
by
gsg
13y ago
Sadly, true. I would cheerfully murder somebody for something as good as Slime for OCaml.
176.
▲
by
gsg
13y ago
It's data races specifically that are undefined behaviour.
177.
▲
by
gsg
13y ago
Note that braces won't save you from if (something); { do_something(); } (Personally, I configure my editor to highlight if (...); in bright red.)
178.
▲
by
gsg
13y ago
Nitpick: it's generalisation that is prevented by the value restriction. Unification works just fine: let test r = r := `A; r := `B; r := `C r gets unified with all of `A, `B and `C: no problem.
179.
▲
by
gsg
13y ago
Sharing is both common and expected, as it arises naturally as a result of writing functions over variants. The language also provides an identity test (==) by which sharing can be observed, so it can't be said to be "behind the s
180.
▲
by
gsg
13y ago
The problem is that Java has consistently failed to be secure enough to safely execute untrusted code, that is code coming from unknown, potentially hostile sources. For running trusted code, Java is fine.
More ›