You are conflating unfreed memory with unreferencable memory.
166 karma · joined November 4, 2014
You are conflating unfreed memory with unreferencable memory.
There are reasonable low-level optimizations you can do that switch is needed for. You can have cases that start or end around blocks in non-hierarchical ways. This makes it similar to a computed goto.
Are you switching between English and some other Latin alphabet language? Or non-Latin?
I generate a .dfont without outline data based on a tweaked version of my favorite bitmap font, in Font Forge.
Now, if there is a way you can pre-render your favorite outline font to a bitmap and write it as a .dfont without outlines (other extensions may be fine, not sure though), you could switch back to Terminal.app. But font tools on GitHub etc. are very very few and never work that well, if they even do what they advertise at all.
$ man 2 intro | grep -w 17
17 EEXIST File exists. An existing file was mentioned in an inappropriateI also agree that if the function's name leaves something to be desired then it should be commented.
You are conflating function names--global and relatively non-contextual--with variable names--which have limited scope and rely on the function name for their meaning.
In the setColor example, I would use setColor for the function name and c for the parameter name (with the caveat that C language doesn't have method names, so my reasoning about context has limited applicability to non-C languages)
grep -r '\<[a-z](' .
And there were no matches. There were some one-character macros but they were macros repeated dozens of times in a localized area.It seems like what's being proposed is descriptive function names with simple variable names. If the function bodies are short enough (e.g. fit on a single screen) then this seems like a good trade-off to me. IOW, the variable names are symbolic but the function names are descriptive.
The short variable names should be clear enough if you understand the purpose of the function.
I also wanted a language that gave a straightforward mental model without an opinionated philosophy that tried to protect me from mutability and other real-world things (hence I didn't really want to go with Haskell and ~purely functional languages).
FWIW I also think the syntax errors in Janet are somewhat hard to grok.
> So I feel like my time is better invested learning Racket instead?
I think it depends. If you want a language you can always rely on for 99% of use cases, something that covers many bases makes sense. For me, I wanted more of a fill-in-the-gaps language where neither C nor /bin/sh scripting make sense (e.g. stuff I may run on Windows or something heavy in string-handling).I may give it a closer look sometime.
When I was using Java in my day job, I toyed with Clojure a bit and it was a pleasure. My favorite features were protocols and multi-arity functions.
The former. Piping with the shell, or C subprocess hosted by the Janet script, or vice-versa.
My complaints about Janet are not too big. I feel like there are many ways to do some things, and they are all basically the same. Most of this excessive flexibility is inherited from Clojure.
1. It's never clear whether I need `cond` or can get by with `case` until I've waffled around a bit
2. I don't know whether to choose `if`, `and`, or `when`, for conditionals, because there are many times when all three would work. Also, if the condition expression is trivially negated (e.g. change '=' to '!=') then even `or` would work, making 4 choices.
3. It's hard to choose between `->` vs. manually-nested expressions.
EDIT: formatting
Janet has os/ and file/ packages, as well as a PEG system which mostly stand in for the best features of Perl. Some low-level POSIX-specific operations (like daemonizing and forking) aren't practical but I can just use C for those.
I am also using it to teach my son very simple programming. He can't type well yet, so the terseness of the language helps (there are cryptic symbols but he likes learning their names and how to type them). Its REPL and functional style I feel help a lot too.
(If I may summarize what you've said) Saying that a large number of coincident deaths causes a collective grief that wouldn't have happened otherwise is rather subjective. I have felt nothing of the sort. I don't think it's enough of a concern to justify such an overreach of government power.
Quantifying the value of life as a number is icky but necessary if you're making decisions of this scale.
if x=$(foo); then
...
fi
is that the stdout of running `foo` replaces the contents of $x and the `if` evaluates the exit code of `foo`. Python doesn't see stdout as some kind of first-class language construct. I also don't think this could ever work on Windows if you expect `foo` to be a simple function that has access to the interpreter state.One such corner case is in pipelines. Only the last command in a pipeline can cause the script to terminate.
Another corner case is `foo && bar`, often used as an abbreviated `if`, will not exit when `foo` fails.
It is not a significant task to just add `|| exit $?` after any command whose failure should cause an abort.
> edit their messages days later to gasslight you
That is a good point. I like to say `s/foo/bar/` to correct myself rather than edit the message. This is also important if people are receiving e-mail notifications for new messages but not for message edits. > > grep . *
> you can "cat *"
The advantage of `grep . *` is that it omits empty lines and includes the source file on each matching line by default. > So it's likely that his avocados cannot be found elsewhere.
Well, according to the video, there is a 1/10k chance an avocado tree is good each time you "roll the dice." For a sense of magnitude, there are only seven types grown in California [1]. So if he is the only source of that avocado type he's sitting on a gold mine.[1] https://californiaavocado.com/avocado101/avocado-varieties/
> The idiomatic way to solve that in rust is to re-bind to the same variable name.
OK, that's reasonable. Is the idiomatic way to use optionals to introduce a layer of nesting? I prefer keeping functions very "flat"-looking. It sounds like Rust's optionals will give people an excuse to create labyrinthine functions where I'm constantly scrolling around to remind myself of what level of nesting I'm at and whether I'm in a loop or not, etc.As you say, you don't need a new block to shadow a previous var, so hopefully that style catches on.
> "oh no, this isn't exactly like c, how will anyone ever understand it"
Not very persuasive, sure, but the network effect of the C/C++ culture (including its general syntax and imperative nature) is a strength in and of itself. New languages would do well to coddle the existing C++, Java et. al. users wherever it doesn't contradict the language's central mission. > Well if you have aesthetic objections to the way rust does it,
I agree with GP that it is harder to maintain ("messy" they say) if there is more than one variable referring to the same value. It is not so subjective as you make it to be. > why not just return any old pointer type?
Using a pointer type in a straightforward manner would entail allocating the object on the heap.If allocated on the stack it has obvious lifetime limitations.
The alternatives to goto cleanup; have drawbacks too - like being less readable (cleanup code is before the main function body or destructors do things implicitly).