584 karma · joined Feb 9, 2012 (14y ago) · 357 submissions
comment 1y ago · link · parent
It is if the caller is expecting there to be exactly one account.
This is why I generally like to return a set of things from any function that might possibly return zero or more than one things. Fewer special cases that way.
But if the API of the function is to return one, then you either give one at random, which is probably not right, or throw an exception. And with the latter, the person programming the caller will be nudged towards using the other API, which is probably what they should have done anyway, and then, as you say, the returns-one-account function should probably just not exist at all.
comment 1y ago · link · parent
I kind of want something like, to borrow JSON-like syntax and gloss over namespacing issues:
(foo .
{type: listy-cons-cell
head: bar
tail: (baz quux)})
...which would be another way to say (foo bar baz quuz), but would make it possible to represent any data structure you like at the same level as atoms, strings, and lists.comment 1y ago · link · parent
I used to debug occasionally but haven't touched a debugger in years. I'm not sure exactly why this is, but I'm generally not concerned with exactly what's in the stack on a particular run, but more with some specific state and where something changes time after time, and it's easier to collect that data programatically in the program than to figure out how to do it in the debugger that's integrated with whatever IDE I'm using that day.
And the codebase I deal with at work is Spring Boot. 90% of the stack is meaningless to me anyway. The debugger has been handy for finding out "what the f*$% is the caller doing to the transaction context" but that kind of thing is frustrating no matter what.
Anyway, I think they're both valid ways to explore the runtime characteristics of your program. Depends on what you're comfortable with, how you think of the problem, and the type of codebase you're working on. I could see living in the debugger being more useful to me if I'm in some C++ codebase where every line potentially has implicit destructor calls or something.
comment 1y ago · link · parent
Too magical for me. I'd rather have something like you described where inputs are explicit, so I don't have to guess about whether the magic will work in any given case.
comment 1y ago · link · parent
So on the less-well-defined end, you have something like JavaScript's `eval` function, in the middle you have lisp macros, which get an AST instead of just source code, and on the actually-pretty-well-defined end, you have a lambda that's already been parsed/compiled and just needs to be evaluated.
comment 1y ago · link · parent
comment 1y ago · link · parent
send friend@rebol.com read http://www.cnn.com
`read` knows that it takes one argument, and `send` knows that it takes two, so this ends up being grouped like (send friend@rebol.com (read http://www.cnn.com))
(which I think is valid syntax; that AST node is called a 'paren').Weirdly, the language also has some infix operators, which seem a bit out-of-place to me. I have no idea how the 'parser'[1] works.
[1] 'parsing' happens so late that it feels funny to call it that. The thing that knows how to treat an array as a representation of an evaluatable expression and evaluate it.
comment 1y ago · link · parent
Future me doesn't really care if I spent 3 hours playing Minecraft, but they would be pleased if that shelf I've been meaning to build for months were finally done.
But also, my brother died recently and left behind a house that was kind of a mess, and that has added "dying me would like my friends/family to be able to easily find the important stuff among all this clutter."
comment 1y ago · link · parent
A lot of people are completely fed up with "more of the same", so they voted for the clown or didn't bother to show up.
Don't blame the voters when they were never given a real choice.
comment 1y ago · link · parent
comment 1y ago · link · parent
So far this has means orchestrating a set of processes just to talk to bluetoothd, automatically connect to boards, guess which /dev/input/event* device each one is associated with, and start reading those and sending data somewhere over OSC. Every step of the process is about 10 times as difficult as I initially expected it would be, which is why, after months of work, I'm still putzing around with process orchestration instead of actually doing anything with music.
The bit of hair on this yak that I'm currently shaving is building a TUI library for Deno so that I can build a nice dashboard for keeping tabs on the state of all the different pieces. I prototyped a bit of the orchestration process in Node-RED, which was neat, but not exactly what I'm going for. There is a TUI library for Deno already, but it's kind of buggy and non-ergonomic for my brain.
comment 1y ago · link · parent
[1] If by 'wealth' we mean numbers in computers. Actual wealth, like healthy land and clean water and manufacturing capacity should be shared by everyone, but currently money is what controls it.
comment 1y ago · link · parent
The only reason I didn't write more stuff in D was that the stack traces from my programs were pretty much useless. Maybe I was supposed to set a --better-stack-traces flag when I compiled it or something idk.
[1] One of the algorithms used by https://github.com/TOGoS/PicGrid
comment 1y ago · link · parent
> You might think that this issue is just about trying to cram everything onto a single line, but frankly, trying to move away from that doesn’t help much. It will still mess up your git diffs and the blame layer.
Diff will still be terrible because adding a step will change the indentation of everything 'before it' (which, somewhat confusingly, are below it syntactically) in the chain.
comment 1y ago · link · parent
I like Deno for similar reason. It's a coarser level of granularity, and not explicitly content-addressed, but you can import specific versions of modules that are ostensibly immutable, and if you want, you could do single-function modules.
I like the idea so much that I'm now kind of put off by any language/runtime that requires users of my app/library to do a separate 'package install' step. Python being the most egregious, but even languages that I am otherwise interested in, like Racket, I avoid because "I want imports to be unambiguous and automatically downloaded."
Having a one-step way to run a program where all dependencies are completely unambiguous might be my #1 requirement for programming languages. I am weird.
One reason not to do things this way is if you want to be able to upgrade some library independently of other components that depend on it, but "that's what dependency injection is for". i.e. have your library take the other library as an argument, with the types/APIs being in a separate one. TypeScript's type system in particular makes this work very easily. I have done this in Deno projects to great effect. From what I've heard from Rich Hickey[1] the pattern should also work well in Clojure
[1] something something union types being superior to what you might call 'sum types'; can't find the link right now. I think this causes some trouble in functional languages where instead of something being A|B it has to be a C, where C = C A | C B. In the former case an A is a valid A|B, but a C A is not an A, so you can't expand the set of values a function takes without breaking the API. Basically what union types require is that every value in the language extends some universal tagged type; if you need to add a tag to your union then it won't work.
comment 1y ago · link · parent
/me raises hand
Maybe if you want to mutate a field, don't mark it `final`?
I know, I know, people like to pretend things are one way and then hand their objects over to some horrid framework that breaks all the rules, because apparently giant web of mutable spaghetti is just fine, not an anti-pattern at all if you let some third-party bull$#!7 ORM/dependency-injection-framework-for-people-who-don't-like-constructors do it.
comment 1y ago · link · parent
comment 1y ago · link · parent
But maybe its natural position is to be centered at x=0 and it had to be moved by 0.5 for the left edges to line up, in which case see my other comment.
In any case, I think the argument over 0 or 1 or 0.5-based indexing can be resolved just by being clear about what it is you're counting.
comment 1y ago · link · parent
comment 1y ago · link · parent
In computer programming we often only need the position of the gap to the left, though, so calling it "the rail that starts at x=0" works. Calling it "the rail that ends at x=1" is alright, I guess, if that's what you really want, but leads to more minus ones when you have to sum collections of things.