|
Fwiw in Python it's the double underscore that's reserved and do not touch territory, not single.
|
# ? Jul 1, 2023 22:28 |
|
|
# ? May 21, 2024 08:29 |
|
_ == protected __ == private Afaik.
|
# ? Jul 1, 2023 22:33 |
|
FlapYoJacks posted:_ == protected Single underscore as a prefix indicates "internal use" by convention only, double causes name mangling. Neither is "private" in the sense that you wouldn't be able to access them if you wanted to. Python code:
|
# ? Jul 1, 2023 22:55 |
|
leper khan posted:C has static for TR-scoped things, it doesn't need dumb underscore rules for fake static. I think it refers to modules not files, i.e. you want a library to call functions in other files, but the linker was so utterly inept it cannot hide internal APIs to users of the library.
|
# ? Jul 1, 2023 22:58 |
|
Volmarias posted:Variable names should not start with underscore _ or dollar sign $ characters, even though both are allowed. In Java, if you have an inner class (a class defined within the scope of another class), it will get compiled into OuterClass$InnerClass. The $ is an allowed symbol for names in Java. I once tried manually defining a class called Foo$Bar and also an inner class Bar inside Foo, and if you do that and have one reference the other the compiler will fail with a weird and unclear error. And that's why you should never actually use the $ for names in your own code. Let it be reserved for the compiler.
|
# ? Jul 1, 2023 23:06 |
|
Carbon dioxide posted:And that's why you should never actually use Java
|
# ? Jul 1, 2023 23:41 |
|
Falcon2001 posted:I mean the one class per file is a Java thing though right? And in Java you can't have just a function hanging out by itself, it has to be contained within a class, so probably that's where that particular brainworm comes from. One public top-level class per file. You can have any number of nested classes, and any number of non-public top-level classes. In a year or so you’ll also be able to define the main() function without needing a class at all, thanks to the magic of JEP 445! There’s amazing innovation going on in the Java community, idk why people think it’s oldfashioned
|
# ? Jul 2, 2023 11:28 |
|
counting on my fingers, a confused expression on my face
|
# ? Jul 2, 2023 16:56 |
|
Beef posted:Another cargo cult Java dev brain damage story: That may have been a Matlab developer
|
# ? Jul 2, 2023 21:41 |
|
Is that enforced or self inflicted in Matlab? I haven't touched it since uni. IIRC the one class per file in Java came out of the early compiler and class loader implementation and they just stuck with it.
|
# ? Jul 3, 2023 00:00 |
|
Beef posted:Is that enforced or self inflicted in Matlab? I haven't touched it since uni. It's sort of enforced through matlab's export system. You can write as many functions as you want in a file, but only the function that has the same name as the file can be seen by functions in other files. There are ways around this but that's how people are told to implement their projects: 1 file per function
|
# ? Jul 3, 2023 00:14 |
|
if you're writing python, and you use the keyword "class", you hosed up
|
# ? Jul 3, 2023 05:30 |
|
DELETE CASCADE posted:if you're writing python, and you use the keyword "class", you hosed up
|
# ? Jul 3, 2023 05:45 |
|
what if there's an @dataclass above it
|
# ? Jul 3, 2023 06:07 |
|
DELETE CASCADE posted:if you're writing python,
|
# ? Jul 3, 2023 06:23 |
|
As a python toucher, that is extremely correct.
|
# ? Jul 3, 2023 06:34 |
|
DELETE CASCADE posted:if you're
|
# ? Jul 3, 2023 06:37 |
|
Should have been a farmer.
|
# ? Jul 3, 2023 06:39 |
|
Loezi posted:
|
# ? Jul 3, 2023 07:13 |
|
In Rails land the Rails loading/reloading system assumes one top level class or namespace per file named the same as the file.
|
# ? Jul 3, 2023 15:39 |
|
FlapYoJacks posted:Should have been a farmer. Train Driver, toot toot!
|
# ? Jul 3, 2023 16:04 |
|
As soon as you touch a keyboard for the first time god sighs and writes your name on the hell list, but you can redeem your immortal soul by using Vigil, the eternal morally vigilant programming language
|
# ? Jul 3, 2023 18:01 |
|
Dirty Frank posted:Train Driver, toot toot! The only good kind of engineer
|
# ? Jul 3, 2023 23:02 |
|
Line 100 of the program: Data ping Set *some landing table *Other conditionals* Run; Line 900: Data ping Set ping Merge pong Run; Line 1400: Proc sort Data= ping By *couple of variables* Run; Line 3000: Data ping Set ping *Fuckton of conditionals* Run; Line 3500: Dara final_ping Set ping Merge ding Run; Line 3900 Proc sort final_ping nodupkey By *esoterica* Run; Line 4300: Data final_ping Set final_ping Merge 20+ other datasets Run; ... My job is to locate the source of nondeterministic row selection in this program. gently caress you.
|
# ? Jul 6, 2023 08:20 |
|
Falcon2001 posted:Bunch of angry words about getter/setter Just dropping in to say I merged a PR today that removed (almost) all this bullshit and it was a net removal of 1533 lines of code. It's the best. I think in terms of actual code base it was probably like...around 10% of our total lines of code. It is crazy.
|
# ? Jul 11, 2023 04:55 |
|
Falcon2001 posted:A giant code dump I am glad that you were able to have a satisfying code movement
|
# ? Jul 11, 2023 06:06 |
|
FlapYoJacks posted:Should have been a farmer. Depending on where you farm, you may still have to deal with pythons
|
# ? Jul 11, 2023 19:20 |
|
Blue Footed Booby posted:Depending on where you farm, you may still have to deal with pythons And Rust.
|
# ? Jul 12, 2023 17:43 |
|
Volmarias posted:I am glad that you were able to have a satisfying code movement Well, that puts a new spin on the concept of a version control system.
|
# ? Jul 12, 2023 18:20 |
|
FlapYoJacks posted:And Rust. And you will still be sued by Apple.
|
# ? Jul 12, 2023 23:21 |
|
I have an enum with 13 constructors and 141 entries. It's a bit of a disaster but enum does fit the type very well. (like Magic the Gathering keywords - flying, vigilance...)
|
# ? Jul 14, 2023 18:07 |
|
Tann posted:I have an enum with 13 constructors and 141 entries. It's a bit of a disaster but enum does fit the type very well. Not sure how much I would agree with that...
|
# ? Jul 14, 2023 20:06 |
|
It’s normal and fine for enums to have a ton of cases.
|
# ? Jul 14, 2023 20:09 |
|
If it's possible to enumerate all the cases, that's exactly what an enum is for.
|
# ? Jul 14, 2023 20:21 |
|
141 entries and 13 constructors sounds suspiciously like it's several enums stuffed into one definition
|
# ? Jul 14, 2023 20:32 |
|
I've seen something like that, where the enum was designed to capture everything that could go wrong in establishing and maintaining a dialup connection. poo poo's complicated.
|
# ? Jul 14, 2023 20:43 |
|
At least in Java it's possible to have enumerations implement an interface. I'd recommend at least considering that sort of thing although I know many people consider elaborate object oriented domain modeling its own sort of horror.
|
# ? Jul 14, 2023 20:44 |
|
Enums for complicated finite state machines tend to get real messy real quick.
|
# ? Jul 14, 2023 23:14 |
|
1337JiveTurkey posted:At least in Java it's possible to have enumerations implement an interface. I'd recommend at least considering that sort of thing although I know many people consider elaborate object oriented domain modeling its own sort of horror. Are Java enums sort of like Union types? From a C# perspective they’re confusing since in C# it’s just a strongly typed list of name-to-Integer mappings.
|
# ? Jul 16, 2023 11:01 |
|
|
# ? May 21, 2024 08:29 |
|
Surprise T Rex posted:Are Java enums sort of like Union types? From a C# perspective they’re confusing since in C# it’s just a strongly typed list of name-to-Integer mappings. IIRC they are classes that exist in a small named number of instances.
|
# ? Jul 16, 2023 13:35 |