For a bit I was opening netbeans just so that I could click a green play button to start a php server. I realized today that I can just run the same simple command as netbeans from my project root, and I get the same environment.
Now if I can figure out how to make gradle build and install an android app, I can skip opening android-studio as well.
When writing a parser in a low-level language like C, how does one allocate strings with good performance? I can't find anything online about this problem, but it seems significant to me.
I've settled on allocating a large char array up front, and exposing two functions.
void add_char(builder* b, char c);
char* end_string(builder* b);
`end_string` adds a null character to finish the current string, and returns a pointer to where that string started.
Is this a good approach?
I'm not sure how I feel about passing parameters by reference in D and C++. I like it because it abstracts the integer nature of the pointer, so I can guarantee that pointer arithmetic mistakes don't exist. I dislike it because the caller syntax make no distinction between ref and value parameters, so I can't tell if a function will modify a variable.
Related is how D overloads `.` to be used where `.` and `->` are used in C/C++.
Of course, T* and T** may refer to arrays and 2D arrays, so the meaning is overloaded and must be communicated out-of-band, but that's not really the point here.
My affection for functional programming makes me want to only take values and return values, but I've begun to appreciate data-oriented design through watching guys like Jonathan Blow and Mike Acton. There are two many slow/memory-hungry programs these days.
I haven't written much code which has to manually manage memory. I am doing so now, and I'm struggling to understand when to malloc, when to use the stack, where to allocate, and where to modify/fill memory.
It seems to me that for function parameters:
T = caller allocates, caller fills
T* = caller allocates, callee modifies
T** = callee allocates, callee modifies
The matrix is completed when returning T, which means callee allocates, callee modifies.
Does this pattern make good sense?
Lam String Expr
App Expr Expr
For HM #TypeInference, these are not sufficient to handle recursion, so we need Let-polymorphism, for which we have
Let String Expr Expr
Seems to me that the following forms are equivalent:
Let var x e === App (Lam var e) x
In other words, Let is just a special case for immediately applied lambdas, so I can avoid adding it to my type, right?
Thank you for your email. Unfortunately I will not be reading it because it uses HTML rather than plain text. Please consider resending this message in plain text format. In the interest of making the web better and safer, I would also suggest making this the default for all of your emails.
If you choose not to comply and are annoyed by this reply to all of your emails, reply with BLOCK ME in the subject line.
Consult https://useplaintext.email/ for help and the reason to use plain text.