4,687 karma · joined Dec 4, 2021 (4y ago) · 1,693 submissions
comment 4y ago · link · parent
I see no problem with that.
If it's cost that is prohibitive, then maybe our societies should start using public money to finance such research instead of wasting it on military spending, and not rely 100% on private companies to build the technology of the future.
comment 4y ago · link · parent
Useful would be, if the default handler for SIGINT would not raise an exception, but have a useful default like eg. terminating the program. Go handles SIGINT this way by default.
If I want an exception, I can just tell the program:
import signal
signal.signal(signal.SIGINT, throwException())
The way it is now, the exception bubbles up to runtime, and if it isn't handled (eg. in the REPL) the program crashes, or worse, hangs if there are other threads of execution running: import threading
import time
def sleepN():
for i in range(20):
time.sleep(1)
threading.Thread(target=sleepN).start()
time.sleep(20)
Press c-C here, and the thread will still run, because the bubbled up Excp only kills the main thread. This is a real footgun in applications which rely on SIGINT being a termination signal, and have long running threads.comment 4y ago · link · parent
Languages like Java, Python or Golang enable inline documentation which can then be used by standardized tools (Javadoc, Docstrings, Godoc).
eg.
https://pkg.go.dev/flag@go1.17.6#PrintDefaults
The entire documentation of this function (including HTML) is generated by the Godoc tool reading comments which conform to a certain convention.
https://cs.opensource.google/go/go/+/refs/tags/go1.17.6:src/...
There is literally no downside to this. The code and its documentation are in the same file, its much simpler for developers to update it when there is a change, and its easy to generate documentation directly from source on the fly.
comment 4y ago · link · parent
If a bug happens in this code, everything is affected, everyone screams at the same time, it is obvious there is a bug, and once its fixed, its fixed everywhere and for every service.
If there is a bug in one of the old init scripts, it may go unnoticed for several years, until suddenly someone needs service Bar depend on Service Foo, but Bar cannot figure out the state of Foo correctly, and good luck to whoever has to solve this: unless the combination of services is a popular one, whoever has this problem, is likely the first to encounter this, there is no general outcry because nothing else is affected by it. A fix may not be forthcoming because the behavior may not even be considered a bug (the maintainers of Foo and Bar may simply disagree how some service state is to be communicated), and usually someone has to trawl through a pile of sh scripts (because backward compatible all the way to the 90s it has to be!) and implements a fix, which then gets destroyed by an update when the guy who fixed it is on holiday.
As someone who has been that exact guy, I have to say sorry but no, I don't want to do this any more.
comment 4y ago · link · parent
Safety guaranteed by the compiler is certainly a great feature, but if this comes at the cost of "visual clutter" the likes of which I am only used to in legacy Java and C++ codebases, then I have to say, no thanks, I'd rather use C and make sure I make as few errors as possible.
Or I just use Go.
comment 4y ago · link · parent
If the code in question is part of the pkg/module/crate/whatever's API, aka. someone else may have to use it some day, it should be commented regardless of how complex it is. Whatever interacts with "the outside world" should be labeled, that's true in code, and that's true with the big red emergency stop button found on heavy machinery. It doesn't matter how obvious the usage is.
comment 4y ago · link · parent
Engineers, as practitioners of engineering, are professionals who invent,
design, analyze, build and test machines, complex systems, structures,
gadgets and materials to fulfill functional objectives and requirements
while considering the limitations imposed by practicality, regulation,
safety and cost.
And the etymological explanation of the word from the same article: derived from the Latin words ingeniare ("to create, generate, contrive,
devise") and ingenium ("cleverness").
Sure seems like what Software Engineers do for a living to me.comment 4y ago · link · parent
Me neither. If the code is good, its author may put in some Haikus about his thoughts about the meaning of life for all I care. If it's to much, I can use my IDE and just hide it.
What bothers me isn't lots of comments per-se, but when more emphasis is put on having lots of comments, than on having good, readable code.
comment 4y ago · link · parent
systemd became the de-facto default init sys because Distro Maintainers have chosen it. I posted this link here before, but I will happily post it again: https://www.reddit.com/r/archlinux/comments/4lzxs3/why_did_a...
Such a thing doesn't happen if the thing offered isn't an improvement over what was before.
As a matter of fact, this doesn't even happen if the thing offered is only a small improvement. We have seen this time and time again in Programmig languages: Exciting, clever new things that offer real advantages vanishing into obscurity because while they were better, they were not better by a large enough margin.
Diversity is great if it offers advantages. Different kinds of RDBMS are a good example. Different kinds of shells. Rust being there as a C alternative, Go being there as a Java alternative, Julia as a possible Python alternative, WASM instead of JS. All great.
But keeping something mainstream just because its different, adds no value. People can and do still use other init systems, but I am very glad I no longer have to wrestle 400-line sh init scripts on my production servers.
comment 4y ago · link · parent
Should we try to write code that is primarily meant to be read? YES! Oh god yes! Code is read 1000x more than it is written. But that doesn't mean "stuff the code with comments".
Primarily, it means write code that is clear, concise, conveys the meaning, is logically structured, is not "optimized" into obscurity before even the first performance measurement has been done, and doesn't implement something just to fulfill some dogmatic paradigm.
Once that's in the bank, we can start using comments where they are needed: Explain Functions that are part of the interface, explain functions that have complex logic, explain imports that aren't part of the stdlib or well known 3rd party libraries. I don't need a comment telling me what `import requests´ is needed for. I certainly do need a comment telling me what the hell `from apputil.tools import tvectorization` does.
comment 4y ago · link · parent
quote:
"What most systemd critics consider "bloat", I consider necessary complexity to solve a complex problem generically."
endquote
comment 4y ago · link · parent
Sure, one could read tons of books about Biochemistry...but applying that knowledge? No chance, you need a lab. One can self-study mechanical engineering, but good luck building a workshop. Its not impossible, but the cost is just too prohibitive.
What do I need to start learning how to write software? An old laptop for a couple hundred bucks and internet access. That's it.
comment 4y ago · link · parent
All it does is increase line-noise, and for what? So we don't have to write 2 short lines, or save an indentation level somewhere?
There is a good reason why assignments in Golang are not expressions, even though they are in C, and the language is otherwise deliberately close to the mindset of C; The added convenience makes the code much harder to read.
Sure;
char c;
while((c = getch()) != EOF) {
// do something
}
requires less lines than; char c;
while(1) {
c = getch();
if (c == EOF)
break;
// do something
}
but it's also easier to read, because each line carries less information. That's what people call "line noise".IMO, := is a step in the wrong direction, and sadly I see python take more and more of these, going from the deliberately simple and clear language to something that's becoming needlessly hard to read by piling on things it doesn't even need.
comment 4y ago · link · parent
Explicit is better than implicit.
And yet, s = ["one", "two" "three"] will implicitly and silently do something, that is probably wrong most of the time.
comment 4y ago · link · parent
...and still have time and money aplenty left for some laughs on the way.
comment 4y ago · link · parent
Even using a PoS approach, crypto is hillariously inefficient. According to the article, less than 500 M tranactions are done via ETH per year. Credit card systems alone handle more than twice that PER DAY.
comment 4y ago · link · parent
I said I spend not a lot of time typing. Therefore, a device that is aimed at improving typing speed, has a low impact on my productivity.
comment 4y ago · link · parent
He typed slowly, not hunt&peck, but really slow compared to the other engineers.
Didn't matter. The guy was a wizard. Ever seen someone implement radix sort in assembly or debugging a microservice using nothing but nc and echo? Without looking up ANYTHING either in a book or online? That kind of guy.
Working with him, I sometimes felt like Mickey Mouse in that scene of "Fantasia: The Sorcerers Apprentice", when the Master came back, surveying the flood, and fixing everyting in seconds just by waving his hands imperiously :D
comment 4y ago · link · parent
I am not defending 10-15 WPM here ofc. just statingt that the majority of work happens before we start typing in code, and after we typed it.