3 ms·
"Lowercase symbols are private to the package they are declared at" This isn't magic, it's just a clever convention.
by foobiekr 2y ago
"Lowercase symbols are private to the package they are declared at"
This isn't magic, it's just a clever convention.
- kortex 2y agoA sufficiently clever convention is indistinguishable from magic.
- onefiveone 2y agoexcept there's no smoke and mirrors for this character saving trick
- lifthrasiir 2y agoIt is a part of the language rules that you can't ever change if you don't want it. It is magic in that sense.
- mariusor 2y agoI always thought that lack of "magic" in a programming language means that when (as a human) you read through source code you are able to reach the end of the program. Opposite to that, in a language that has "magic" you reach a point where you don't know where execution will go next without the help of the compiler (or a heavy duty IDE that translates for you).
- lifthrasiir 2y agoThat's very subjective I guess, because it would also depend on your familiarity with the subject matter. I can for example easily read and understand a recursive descent parser in any language because I have implemented it multiple times and can catch a common pattern. Unless the language in question corrupts that pattern (highly unlikely unless it's an esolang :-), that definition of "magic" should be largely independent from the language itself.
- mariusor 2y agoIt's not about understanding the language, it's about how an element in the code can mean different things. Think how in Ruby you can get monkey patched behaviour that overwrites a method name for some type, or even the init() function in Go, that someone mentioned in the sibling comments that gets executed at module load, so when you encounter state that should be a zero value, it's actually not. If as a developer reading the code, there's no way to know if the compiler injects some behaviour in or around the thing that you're looking at, that's magic.
- yencabulator 2y agoYou also can't change the if statement, is that now magic too?
- lifthrasiir 2y agoYes, that's why I needed "in that sense". As noted in replies, I believe many naive notions of magic really depend on one's background and context.
- kstenerud 2y agoIt's clever, right up until you come up against the fact that many languages don't have uppercase/lowercase (e.g. Japanese) - and now you have to add an extra hack to work around your original hack. Any time you add a clever hack that re-uses something you don't control directly (Unicode, file names, existing data formats, implicit behaviors of a system - or even explicit since you don't control who will change it later, etc), you're making a mistake that will come back to bite you eventually. In fact, I dare to say: Any time you think you're being clever, you're not. Most of the design mistakes of go were made under the assumption that all complexity can be reduced. There are certain kinds of complexity that can only be moved around, not reduced (e.g. init, os-specific compilation, packaging and such).
- aatd86 2y agoI wonder if users of other alphabets really use their alphabet to code in roman based languages. I mean, even the keywords are not transcribed, right? I guess they could probably prepend a v or V to their variable names? And especially if the code is to be shared with an international community? Wondering.
- mardifoufs 2y agoI've never seen that happen. English is my third language and the only time I've seen people talk about programming in other languages was either when referring to very old esoteric prog languages, or in English speaking forums ironically enough. It happens and I've seen code written in french for example but it's considered an anti pattern almost everywhere. I guess sometimes it makes sense for constants or context dependent variable names but again, still very rare.
- pjmlp 2y agoI was once brought into a PowerBuilder project, during the discovery phase due to my French skills more than anything else, and naturally was cheaper than getting an external translator. Everything except API calls was in French. I also have seen enough code during my lifetime with comments, and occasionally code as well, in Portuguese, Spanish, Italian, German.
- papichulo2023 2y agoIt is not clever, especially for serialisation
- 38 2y agonot at all - you ever tried to export or unexport an identifier module wide? its a huge fucking pain in the ass - versus a one line change with other languages