Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
sjolsen
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
20 ms
·
121.
▲
by
sjolsen
12y ago
> Another place where macros in Lisp fail is that they may evaluate an expression twice Strictly speaking, macros don't evaluate their expressions at all. Square is a bad example, though. Macros are not for writing function-like exp
122.
▲
by
sjolsen
12y ago
> In Lisp, source filters never break. > Never. To be perfectly fair, this is not quite true. In Common Lisp (the dialect being used here), macros can break in rare, subtle ways. The obvious happens when you don't use GENSYM:
123.
▲
by
sjolsen
12y ago
> What's the distinction between C-c C-space and C-c C-r? Beats the hell out of me. Here's the docstring for agda2-give (bound to C-c C-SPC): Give to the goal at point the expression in it Here's the one for agda2
124.
▲
by
sjolsen
12y ago
That should read, "Type the following into the Emacs buffer." You should have something like: module LearnYouAn where data ℕ : Set where zero : ℕ succ : ℕ → ℕ _+_ : ℕ → ℕ → ℕ zer
125.
▲
by
sjolsen
12y ago
It is not used literally everywhere. It does not always "just work," as the original post demonstrates. It often happens to be good enough for most practical purposes, yes, but arbitrary-precision arithmetic is better for most pra
126.
▲
by
sjolsen
12y ago
All arithmetic in C and C++ is toxic. That's the reality of using bounded-precision types. Honestly, I wish they'd had the foresight not to use the traditional infix operators for built-in types; they practically beg programmers
127.
▲
by
sjolsen
12y ago
> so whenever we have 128-bit or 256-bit registers, we'll have to go back and update all this code that effectively "optimizes" 1 bit of information This is why we have uint_least8_t and friends. In fact, int is really jus
128.
▲
by
sjolsen
12y ago
> There are a bunch of new ‘transitions’ between elements. I don’t know what the battery cost actually is for this, but as a user I just don’t care about cute transitions between elements. I want fast interaction with my mobile device. I
129.
▲
by
sjolsen
12y ago
Is there a particular reason everything is implemented as member functions? I feel like typing things like mathfu::Vector <float, 3>::CrossProduct (u, v) instead of cross_product (u, v) would get really old really fa
130.
▲
by
sjolsen
12y ago
> The only super legit argument I've heard in favor of _not_ using templates or avoiding them in general is because of the code generation bloat And even then, it's important to recognize that bloat is a relative measure. If yo
131.
▲
by
sjolsen
12y ago
I won't contest that! But C is crazy enough that suggesting it as an alternative to C++ because C++ is crazy is, well, crazy. If you can handle the crazy of C, you can probably handle C++, because the crazy specific to C++ usually at l
132.
▲
by
sjolsen
12y ago
> At least, C can fit in a brain. A typical programmer's mental model of C can fit in a brain. Actual C is every bit as complex and nuanced as C++; it just has a narrower scope. I mean, C++ may be crazy, but don't pretend a lan
133.
▲
by
sjolsen
12y ago
I think chording is the least of one's worries; the awkward staggering of the IBM-style keyboard and the modifiers designed to be pressed by a curled pinky (especially Shift) are murder on my hands, chords or not. From a strictly ergon
134.
▲
by
sjolsen
12y ago
> what qualities of a language make it designed for compilation? That a language that compiled to good machine code was one of the main goals of the people who designed it. I was making a historical statement, not a qualitative one.
135.
▲
by
sjolsen
12y ago
> Compiled vs interpreted is not a property of the compiler. I assume you meant "language." You're of course correct, but if ever there were a language that deserved to be called "compiled," C is it. It truly was
136.
▲
by
sjolsen
12y ago
> but don't then say that existing code still compiles fine. Oh, I'm not disputing that a lot of existing C code wom't compile as C++; I'm just nitpicking the claim that good C code won't compile as C++. ;) B
137.
▲
by
sjolsen
12y ago
> The typical case is when you call malloc. And if there were a proper type-parameterized entry point to malloc (be it a function or macro) for general-purpose contiguous-object allocation, you wouldn't have to compromise the alread
138.
▲
by
sjolsen
12y ago
> C++ compilers will reject a lot of good C code, mostly because it disallows implicit casts from void * When did code that implicitly casts from void * become "good?" Implicit conversions from A to B should never happen unle
139.
▲
by
sjolsen
12y ago
Seriously, computer science itself is a branch of mathematics. Or is mathematics a branch of computer science...? It's not always weird bit-level arithmetic, but if you aren't using math at some level, you're not programming;
140.
▲
by
sjolsen
12y ago
> I'm not sure if it's usually the mix of a "smart" C programmer writing a program that is patched by a "hobby" C programmer, or the fact that getting C right is just too hard -- or that people don't -W
141.
▲
by
sjolsen
12y ago
C++ and Java are statically typed. If you're referring to dynamic polymorphism , then yes, it can be a pain in the ass.
142.
▲
by
sjolsen
12y ago
My preferred method—well, actually, my preferred method is to use std::uniform_int_distribution—but in lieu of that, I prefer to use an adapter that builds values in a target range bitwise from values in a source range. The basic idea is to
143.
▲
by
sjolsen
12y ago
> However, because the implementation of rand is unknown, it is impossible to tell whether or not using modulus to shrink the range will result in an acceptably random sequence. The reason that this might not be the case is due to the ve
144.
▲
by
sjolsen
12y ago
I find it strange that they give measurements in terms of pixels. When pixel density ranges from 96 pixels per inch to 200 pixels per inch and beyond on consumer hardware alone, pixels simply aren't an appropriate measurement for UI pu
145.
▲
by
sjolsen
12y ago
> Is reading a 4-byte int from a non-multiple-of-four address explicitly undefined behavior? A type in C or C++ has an alignment, queryable through C's _Alignof and C++'s alignof. This is not necessarily the same as its size, t
146.
▲
by
sjolsen
12y ago
> On a platform that doesn't have alignment requirements, it's not a bug to access misaligned data Consider the following statement: > On a platform that has well-defined signed overflow, it's not a bug to perform signe
147.
▲
by
sjolsen
12y ago
Enjoyment, primarily.
148.
▲
by
sjolsen
12y ago
> There is nothing modern about the new features of C++11/14 There's nothing modern about any feature that's been introduced into a popular programming language in years. They're all rediscoveries or minor iteration
149.
▲
by
sjolsen
12y ago
Edit: It occurred to me after posting this that by "length + data" you might mean actually storing the length with the string data . If so, you're right, that's stupid. The correct solution (well, it's better tha
150.
▲
by
sjolsen
12y ago
> Why the hell would you want to do that? To isolate all of the initialization logic for a single object (e.g., "result1" or "result2") into its own scope. You could use a function (in fact, that's exactly what
More ›