|
Tei posted:I like JSON because "use UTF-8 or else gently caress you" is a good call. You misunderstand. This is for file paths, not data. It exists because otherwise it would be impossible to represent arbitrary POSIX paths as Python strings.
|
# ¿ Jan 14, 2022 12:21 |
|
|
# ¿ May 17, 2024 18:50 |
|
You can still put control sequences in filenames, but common things like ls will escape them, and most modern terminal emulators refuse to implement control sequences they consider security risks, or at least disable them by default
|
# ¿ Jan 21, 2022 10:53 |
|
chglcu posted:Just write your free immediately after you write your malloc, you lazy poo poo. Only being semi-ironic here. Memory management just really isn’t that hard. The NSA thanks you for your commitment to their future
|
# ¿ Mar 6, 2022 13:53 |
|
raminasi posted:200 for everything is definitely an extant pattern. Honestly I think it's fine if it's documented and consistent and the responses are machine-readable (i.e. you don't need to parse error strings). If
|
# ¿ Jul 15, 2022 20:20 |
|
That’s not quite enough, because people want to add methods that extend existing data types. Like, extending methods. Extendy methods. Something like that.
|
# ¿ Aug 7, 2022 11:13 |
|
Jigsaw posted:otherwise I don’t see why it should fail to parse and run I guess the question is “why does for…in take an arbitrary lvalue”. What use cases are there for binding anything other than an identifier or a tuple of identifiers, like we all probably assumed it did until we read that post?
|
# ¿ Dec 3, 2022 19:43 |
|
Hammerite posted:love to see a library in which every property accessor has a documentation string that says either "gets the value of the Foo property" or "sets the value of the Foo property" as though that were helpful to anyone, clearly solely because there is some policy saying that every method and property accessor is required to have a documentation string so they can claim they reach some documentation target and nothing anywhere in any documentation or comment that explains what Foo means
|
# ¿ Dec 31, 2022 15:10 |
|
They should just have rewritten the whole thing in algol
|
# ¿ Jan 2, 2023 02:37 |
|
brap posted:fwiw the compiler actually eliminates the unnecessary comparisons in this case. Does it? Like, it could in this case, but I’d be kind of surprised if they bothered to implement that, given that it’s only possible in certain specific situations and the benefit is likely to be insignificant unless there are vast numbers of cases.
|
# ¿ Jan 22, 2023 18:27 |
|
rjmccall posted:It falls out of any basic CSE / GVN optimization to the point that it would be weird not to do it. And eliminating redundant branches is a very worthwhile optimization in general; people tend to write a lot of redundant range checks, and reducing branch density is very good on modern processors. That’s happening at a lower level surely? I was talking about specifically the difference between the switch vs if/else chain, where I’d be surprised if the compiler emitted significantly different code for each.
|
# ¿ Jan 23, 2023 11:30 |
|
Petition to rename groovy to groverlang
|
# ¿ Mar 17, 2023 22:21 |
|
OddObserver posted:PowerShell looks like they really wanted to show off finally having good tab completion. Powershell is awful for completion tho because they went with verb-noun, which is generally bad because it’s easier to guess the noun than the verb and you’re more likely to want to ask “what can I do to a Folder” than “what kinds of thing can I Get” AWS cli is terrible for exactly the same reason
|
# ¿ Mar 31, 2023 21:21 |
|
QuarkJets posted:AWS CLI sucks poo poo for sure, and boto is just a big pile of garbage made by idiots. It's seriously bad Boto haram
|
# ¿ Apr 1, 2023 11:12 |
|
FlapYoJacks posted:Yes, most of them are pretty intuitive. Unlike powershell commands, -h is drat near always help as well. code:
|
# ¿ Apr 2, 2023 06:51 |
|
FlapYoJacks posted:Imagine defending Powershell syntax lmfao. Imagine defending unix cli syntax lomarf grep -h is another fun one, although without any other arguments it just does the same as plain grep so you do get a usage summary
|
# ¿ Apr 2, 2023 09:34 |
|
CPColin posted:
ftfy (I have genuinely used this)
|
# ¿ Apr 5, 2023 09:41 |
|
Xarn posted:I don't think you can typedef enable-ifs #define doesn’t care about your templates
|
# ¿ Jun 7, 2023 11:05 |
|
Beef posted:Another cargo cult Java dev brain damage story: that’s not even a thing in java!
|
# ¿ Jul 1, 2023 18:16 |
|
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 |
|
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. They’re sugar for collections of singletons with special compiler support to let you use them in switch statements, and special support classes like EnumSet and EnumMap that take advantage of the compiler-generated ordinal() method to use them as efficiently as integers in other common situations.
|
# ¿ Jul 17, 2023 08:44 |
|
RPATDO_LAMD posted:Also how would you teach stuff like trees and linked lists in a 'friendly' language without pointers like java or python? Possibly java.util.LinkedList and java.util.TreeMap might contain some hints
|
# ¿ Dec 10, 2023 12:57 |
|
nielsm posted:It's called being omakase. Nah, omakase means you trust the chef to deliver a good meal with minimal specifications. Golang is all about you having to write out every single step by hand because abstraction is scary, it’s literally the opposite
|
# ¿ Dec 11, 2023 13:24 |
|
LOOK I AM A TURTLE posted:drat near any language? You definitely can't use the pattern in C-family languages like C, C++, Java or C#, as they all require the case expressions to be made up of only constant values. Don’t worry, JEP 455 will fix this in a year or two!!!
|
# ¿ Dec 23, 2023 12:49 |
|
more falafel please posted:In college I interviewed for an internship at Microsoft (they'd bring a bunch of recruiters and engineers on campus once a year and interview basically every 3rd/4th year CS student) and I was definitely in my smarmy-Unix-kid phase, which intersected heavily with my any-program-worth-writing-can-be-a-Perl-oneliner phase Well obviously not, you forgot the separator argument for join
|
# ¿ Feb 7, 2024 08:56 |
|
more falafel please posted:goddamnit larry how does it not default to $_ (probably because it's in list context and all the args get collapsed, once again goddamnit larry) I think technically your code uses the result of “reverse split” in scalar context (i.e. the number of words), to join an empty list. So the result is always an empty string. Perl is fun!
|
# ¿ Feb 7, 2024 09:21 |
|
Bruegels Fuckbooks posted:Why I am I getting blamed for this third party AI company's gsps not storing in dicom server? Count yourself lucky it was 1337 not 1488
|
# ¿ Feb 15, 2024 13:00 |
|
code:
|
# ¿ Mar 11, 2024 10:41 |
|
Jen heir rick posted:You should use Count instead of Contains. That way it'll iterate over all the numbers and you won't miss anything. This will also ensure the runtime is constant, which is an important security property as it will stop hackers using timing attacks to work out what number you are testing for evenness.
|
# ¿ Mar 11, 2024 16:43 |
|
QuarkJets posted:Native Python sure, TKinter sucks, but Python also has extremely good support for Qt and Qt is still a gold standard in desktop gui design, so that'd be a reasonably good choice. Put it this way … if you’re writing python today, most likely you’re writing it either in vscode (electron) or pycharm (java). I think the desktop apps I use regularly (ignoring the browser itself and stuff built into the os) are a pretty even split between electron, java, and native qt. I don’t think any of them are written in python.
|
# ¿ Mar 25, 2024 11:14 |
|
The problem with it is that having a case statement in the middle of a loop is the kind of thing that might plausibly be undefined behavior or a compiler-specific extension. It’s obvious what the code intends to do, but it’s not a common idiom, so unless you’re familiar with the trick, it’s not obvious whether it will actually do that reliably, even if you run it and it seems to work on your machine. That’s why it’s bad code.
|
# ¿ Apr 10, 2024 19:22 |
|
|
# ¿ May 17, 2024 18:50 |
|
leper khan posted:what. I didn’t say it was against the spec. I know it’s not against the spec. I said it was the kind of thing that looks like it might be against the spec, and is bad code for that reason. leper khan posted:case statements in a loop have no issues Coding Horrors: case statements in a loop have no issues
|
# ¿ Apr 10, 2024 22:21 |