There have been multiple accounts created with the sole purpose of posting advertisement posts or replies containing unsolicited advertising.

Accounts which solely post advertisements, or persistently post them may be terminated.

programmer_humor

This magazine is from a federated server and may be incomplete. Browse more on the original instance.

solidgrue , (edited ) in Brace Style
@solidgrue@lemmy.world avatar

Looks like Python, but in an editor with a weird TUI scrollbar

subignition ,
@subignition@fedia.io avatar

High chance that it's a Python programmer who is really unhappy about having to work in Java, lol

tan00k ,

Agreed. I saw this and thought it looked beautifully passive aggressive

hemmes ,
@hemmes@lemmy.world avatar

Ha! Now I see it - that was very funny, sir!

arudesalad ,

Doesn’t python need colons after if/else/for/etc. statements?

_stranger_ ,

Heh, so in Python it’s possible to overload operators in the context of objects. I bet it would be possible to overload tabs to do the same thing as colons inside a context manager, but that’s pure speculation.

takeda ,

Perhaps I don’t understand you, but I don’t think there’s a way to override spaces in python in any way. The spaces are handled by the parser.

_stranger_ ,

You can define what happens for an object when an operator is applied (like +, /, or -) so that you can obj+obj. I wonder if there’s a way to override “tab” such that it acts like a “:”, but from inside the language (this is trivial if you edit the language itself like you suggest). Thinking about it more, I’m guessing not since “:” isn’t an operator and this doesn’t have a corresponding operator function.

palordrolap ,

If Python has anything like Perl's source code filters, then anything's up for grabs, but Perl is kind of weird in a way that Python was specifically designed not to be. Or at least Python 1 was. Things may have changed in the intervening couple of decades.

If it's just plain overloading, then whitespace is probably off the table. Spaces, even required spaces, aren't so much syntax as they are structure. You could argue that the curly braces of some other languages are more syntactic than Python's whitespace, because it's actually Python's magic colon and the first unindented line (lack of whitespace!) that serve that specific syntactic purpose.

Examples of Perl's source code filters range from turning a program into binary representation of the syntax tree and still having it be executable, to new syntax, to writing programs entirely in Latin or something that looks almost but not entirely unlike it, anyway.

takeda ,

I see. I would love to be proven wrong, but I don’t see a way this would work with tabs/spaces in python.

frezik ,

IIRC, Python handles whitespace indentation by having the tokenizer convert them to INDENT/DEDENT tokens. The grammar can then handle them equivalently to a curly brace language.

zaphod ,

You can write Fortran Python in any language.

BartyDeCanter , in True?

And… they’re basically all correct. Linux does run on all sort of machines, even really ancient ones. It has a solid command line environment, or rather lots of them. And it’s astounding powerful. Windows does still blue screen, is currently the best place for gaming, and wow is MS fucking you with Win11. Macs can have a cool setup, are really simplified for most users and expensive.

disguy_ovahea ,

Macs excel in multimedia creation. It’s not just a cool setup. Yes, I’m prepared for the inevitable downvotes.

SpaceNoodle ,

Yeah, more software was written for the more user-friendly computers with the (generally) less-technical userbase.

disguy_ovahea , (edited )

Yeah, the people at Pixar have no clue how to use a computer. Lol

In all seriousness, even the same media software, like Pro Tools, is more versatile on Mac than on Windows. I can say that with first-hand experience.

The “dumbed-down” Apple device is the iPhone. You get admin privileges on MacOS like a big boy. You can use bash or zsh commands in Terminal all you want.

SpaceNoodle ,

Did you miss the word “generally?”

Having a familiar console is nice, but you still can’t truly tinker with all the nuts and bolts.

disguy_ovahea , (edited )

Sure you can. You can even override the T2 chip in Recovery Mode. The thing I miss on an Apple Silicon Mac is installing Windows. It was a big downside for me, so I held onto my Intel Mac until a few years ago. I used to have a tri-boot Mac Pro running Snow Leopard/Windows XP/Red Hat. Then I downgraded to an Intel iMac with macOS/Windows before my M2. I do miss the versatility of Intel Macs.

BatmanAoD , (edited )

You get admin privileges on MacOS like a big boy. You can use bash or zsh commands in Terminal all you want.

Cool. So try updating to a version of Bash from the last 15 years, because the pre-installed one is Bash 3, because Bash 4 and 5 are under the GPLv3 license, which Apple won’t comply with.

…ah, no, you can’t update the pre-installed Bash, because it’s on a section of the file system that is read-only even with admin access. You can install Bash 5 as a separate shell, and use that as your default terminal shell, but any scripts written with the standard #!/bin/bash instead of the more flexible #!/usr/bin/env bash will still use Bash 3.

This “handholding” (or really, a safety net) is arguably a good thing, or at least a positive tradeoff; but you can’t claim it doesn’t exist.

disguy_ovahea , (edited )

I agree it’s not as limitless as Linux, but there’s plenty of room for advanced users.

I’ve never needed to use a newer version of Bash. What is an example of something one couldn’t do with Bash 3 or zsh?

TheGalacticVoid ,

I get that this is an Apples to Oranges comparison, but Powershell 7 is way easier to use than the default Windows Powershell because of autocomplete. I imagine that newer versions of Bash have made improvements that are similarly powerful.

disguy_ovahea ,

Oh, gotcha. I thought you were talking about limitations, not features. My misunderstanding.

BatmanAoD ,

It’s not so much a problem of there being things you “can’t do” in other shells or older Bash, as that it breaks existing shell scripts, which is frustrating.

TrickDacy ,

I’m not sure what you mean. I have updated bash with a single homebrew command.

dust_accelerator ,

The poster you’re replying to was not referring to 3rd party software in user space.

TrickDacy ,

Ok, yeah, I can see that there would be times this could matter but like 90% of the time this wouldn’t have mattered for my use case afaik. I didn’t realize you couldn’t backup the old copy in /bin and symlink to the brew one from there. In fact I thought I did do that long ago.

BatmanAoD ,

Did you read the linked Q&A?

What do you get if you run /bin/bash --version?

TrickDacy ,

It’s been a long time since I even did this, and I’ve gotten at least one new machine since. I got several replies so I’ll just link my original response: lemmy.world/comment/11431853

BatmanAoD ,

Just because it doesn’t matter for most users doesn’t mean it isn’t a real limitation. I acknowledged as much in my original comment.

computergeek125 ,

If it’s anything like when I used a Mac regularly 7y ago, Homebrew doesn’t install to /bin, it installs to /usr/local/bin, which only works for scripts that use env in their shell “marker” (if you don’t call it directly with the shell). You’re just putting a higher bash in the path, not truly updating the one that comes with the system.

paperplane ,

That’s mostly still true, with the small caveat that the default prefix on arm64 macOS is /opt/homebrew rather than /usr/local, so you might have to add it explicitly to your PATH

computergeek125 ,

Oh thank goodness, that was one of my main complaints with the system. Did they ever get around to requiring sudo like Macports (and any other reasonable system level packages manager on BSD/Linux)?

TrickDacy ,

It’s been a long time since I even did this, and I’ve gotten at least one new machine since. I got several replies so I’ll just link my original response: lemmy.world/comment/11431853

computergeek125 ,

Gotcha. Yeah low level Unix has some weird stuff going on sometimes.

RecluseRamble ,

Yeah, the people at Pixar have no clue how to use a computer. Lol

Do you really expect their artists to be IT experts? You seem to be stuck in the early 90s mindset when “knowing how to use a computer” covered all disciplines.

MonkderVierte , (edited )

Weren’t they the guys who made Gimp to Gimp Studio or something like that?

Vilian ,

they actually use linux for render

ggtdbz ,

I don’t think I’ll ever be a Mac user but I’ve seen how fast these newer MacBooks edit video on battery power without breaking a sweat (and without eating through the battery).

People focus on “software magic” with Apple but the M chips are serious hardware that a lot of us don’t take seriously because the company that killed the iPod made them.

disguy_ovahea ,

What’s interesting is the Apple CoreAudio system on iOS and macOS is as good as it is from their experience developing the iPod. For years after the iPod was discontinued, audiophiles were paying top dollar for used iPod Classics, just for the high quality DAC. The low-latency and high quality of CoreAudio is one of the reasons Pro Tools works better on Mac than on Windows.

ggtdbz ,

Oh, I’m well aware. Every few months I search online for used Classics in working condition in my area because that’s a project I’m interested in, but I haven’t committed to it yet. Maybe I should as they are apparently getting expensive and harder to find everywhere.

disguy_ovahea ,

Do yourself a favor and swap the battery when you do the storage. The most challenging part of the job is carefully prying apart the housing without causing cosmetic damage.

nexussapphire , in Brace Style

Last day at the company, pushed over 5,000 commits. Just style changes, still passes all the checks.

KairuByte ,
@KairuByte@lemmy.dbzer0.com avatar

This would never pass PR review.

el_abuelo ,

Jokes on you, we don’t have PR review.

nexussapphire ,

Do your code reviewers subscribe to the didn’t check looks good model? Joking btw.

KairuByte ,
@KairuByte@lemmy.dbzer0.com avatar

Dear god

el_abuelo ,

He can’t hear you all the way down here.

dejected_warp_core ,

This is fine.

NigelFrobisher , in Brace Style

My credo on this kind of thing is never do something that will make your successor so mad that they find out where you live and post parts of your body to Interpol.

dejected_warp_core ,

Good fences make good neighbors.

Corollary: server-side commit hooks make good teammates.

bruhduh , in When your shower uses GitHub more than you
@bruhduh@lemmy.world avatar

Cool idea tho, it’ll help redditors to maintain hygiene

Mesa , in When your shower uses GitHub more than you
@Mesa@programming.dev avatar

Imagine going to take a shower to relax and instead seeing this.

sunglocto , in Brace Style

Idk why but i fell in love with this and might just use it now

Vilian ,

God

morrowind ,
@morrowind@lemmy.ml avatar

It would be nice and easy if we had elastic tabstops

Vilian ,

That’s true, I wanted to port that to Kate for me to test, but I’m too dumb to port the Scala implementation to QT/KDE framework

NigelFrobisher ,

I just realised why we do live coding interviews.

mox , (edited ) in Brace Style

Growing up with C made me assume semicolons and braces were needed to avoid subtle bugs, but experience with more recent languages showed me that it’s possible to reliably parse the same semantic cues that humans use: indentation, parentheses, and other such context. (Perhaps this was less viable when C was invented, due to more constrained hardware.)

I was skeptical at first, but in practice, I have never encountered a bug caused by this approach in Python, Nim, or any other language implementing it consistently, over the course of a decade or two using them. Meanwhile, I have seen more than a few bugs caused by brace and semicolon mistakes.

So nowadays (outside of niche & domain-specific languages) I see braces and semicolons as little more than annoying noise and fuel for religious arguments.

GBU_28 ,

Plus any decent editor catches when lines are unreachable or in violation due to misformatting.

If not that, which seems unlikely, your unit tests would

Ephera ,

Well, Python kind of does the reverse of a semicolon: If you want to continue a statement over multiple lines, then you have to \
escape it.
Python also then tries to avoid multi-line statements for that reason, but yeah, in most other languages this would be equally as annoying as semicolons are.

There are some languages which use neither, for example Scala, but I can at least say that while I consider the people behind Scala and Rust equally competent and the languages more or less equally modern, Rust just completely blew it out of the water in terms of error messages despite being much younger. (Not because Scala is bad, Rust is just incredibly good there.)

And yeah, I’m suspecting that Rust using semicolons makes the difference there.
While Scala will pretty much have to guess where a statement with compile error ends, Rust just knows it ends at most at the next semicolon.

I will also say my experience is opposite of yours. I have managed multiple times to try to access a variable in Python, which wasn’t in scope anymore, because the indentation wasn’t enough of a visual cue to me.
And in any modern language, missing/missplaced semicolons or braces are a compile error, with clear error message where it’s missing. I genuinely don’t even know how you’d get a bug out of that.

mox ,

Well, Python kind of does the reverse of a semicolon: If you want to continue a statement over multiple lines, then you have to \ escape it.

That’s not true. Being within parentheses, brackets, quotes, etc. is enough for the parser to know you’re continuing. In practice, I find that context is already present in most cases.

For the other cases, occasionally surrounding an expression in parentheses is easy enough. Long conditionals probably deserve parentheses anyway, for clarity.

Ephera ,

Well, it mostly being already correct is what I meant with Python avoiding multi-line statements.

In JVM languages, Rust etc., it’s for example popular to use Fluent Interfaces. These also reduce visual clutter and the number of variables in scope (and/or the need for mutability).

I did not know about enclosing them with parenthesis, but apparently that works, too, as this library shows: pypi.org/project/fluentpy/

sparkle ,

I am a Scala and Rust fan. I can corroborate what you said

The part about no semicolons/curly braces I like in Scala is that I can write a function and it’ll look virtually indistinguishable from a regular ol variable. Functions become much less of a ritual and integrate more nicely with the rest of the code. Other than that though, Rust definitely wins out because of the curly braces & semicolons. I use curly braces in most situations in Scala where I’d normally use them in Rust, and I would use semicolons everywhere in Scala if it weren’t considered unidiomatic. Whitespace-significant syntax is just really annoying to deal with. Using Python or even maybe F# makes me want to die because I keep accidentally missing an indent somewhere or indenting too much somewhere else or using the wrong kind of whitespace and the entire program implodes. At least Scala and Kotlin keep it sane

Also it’s just way harder to visually organize in whitespace based languages. You basically have to do a bunch of magic tricks to make the code look slightly different in a specific scenario than what the language wants you to. Rust allows you to actually visually organize your code easily while also having a strong style rules which you shouldn’t stray too far from (or else the compiler will yell at you).

Monstera ,

Fortran is ancient and does fine without ;

mkwt ,

When Fortran was created, each line was a separate punched card. The syntax made sense for that medium.

C was setup from the start for use on teletypes with fancy line editors like ed.

magic_lobster_party ,

In Java it’s quite difficult to forget semicolon and still have a syntactically correct program.

I think braces are incredibly important. With Python it can be confusing which indentation is correct when copying code between files. Different indentations can easily be still syntactically correct, but the outcome is vastly different. It’s often I have to double and triple check to verify I copied the code with correct indentation.

mox , (edited )

It’s often I have to double and triple check to verify I copied the code with correct indentation.

I vaguely remember facing that issue once or twice in the past, but certainly not often. It was because the pasted code was too long for its starting point to be easily found in my editor, even if I scrolled up a bit.

If this happens to you often, I wonder: perhaps the code you maintain should be broken into smaller functions?

If I was in that situation again, I think I would simply place a bookmark before pasting and then jump back to the bookmark to indent/dedent the pasted block appropriately.

Edit: Come to think of it, I would have to check and correct it regardless of the language and braces, since confusingly indented code is unwelcome in my commits.

spikespaz ,

Don’t you use a formatter that fixes whitespace in sloppy writing?

mox ,

I’ve never needed one.

humbletightband ,

It’s kinda organic in python, but God forbid how often I made mistakes in yaml learning k8s

mox ,

Haha… Yes, I’ve found yaml to be problematic in this area, too. Probably because it lacks the context cues and modularity of a programming language.

humbletightband ,

Context cues could be provided by jsonschema, but still it’s unbearable in comparison even with json.

leftzero ,

As someone used to working in c# (and before that Java, C++, Visual Basic, and Pascal) I haven’t seen any brace or semicolon related errors since the days of Borland IDEs (any remotely self respecting IDE will highlight them and refuse to compile, these days), but working with Kotlin has shown me that I, at least, read code with semicolons slightly faster than code without.

There’s a reason we use punctuation when writing, and the same applies to code.

ChickenLadyLovesLife ,

Borland IDEs

Ugh, you just gave me Turbo Basic flashbacks. My favorite thing was that variable names could be as long as you liked and mixed case, but the compiler only used the first two letters and case insensitive at that. So “BatShitCrazy” and “BALLPARKESTIMATE” actually referenced the same variable.

uis ,

GCC has separate warning when braces don’t match identation

Reddfugee42 , in Brace Style
match , in Brace Style
@match@pawb.social avatar

This should be its own language. Pyava.

jwt ,

Or Jathon (pronounced like Mike Tyson would pronounce JSON)

runeko ,
@runeko@programming.dev avatar

Or we can round out the confusion and call it PythonScript

veganpizza69 , in Brace Style
@veganpizza69@lemmy.world avatar

why stop at curly brackets? Do all of them: parentheses, square brackets, angle brackets, and curly brackets. Also, strings should be liberated. Move all non-escaped quote characters to the end of the line too.

psud ,

And escape the newlines that you introduce in the strings

NeatNit , in I am a software developer at PornHub

That was great

sleen ,

Unfortunately still doesn’t explain what to do when you’re covered in piss 😔

toomanypancakes ,
@toomanypancakes@lemmy.world avatar

At that point you either take a shower or start licking

lars ,

Would you do it for $100?

toomanypancakes ,
@toomanypancakes@lemmy.world avatar

If I had the $100 to spare I’d totally take you up on that

towerful ,

Clearly you use your keyboard to dry you off

Aussiemandeus ,
@Aussiemandeus@aussie.zone avatar

You mean p!$$

Th4tGuyII , in Quantum Lock suspends sales due to developers losing access to source code
@Th4tGuyII@fedia.io avatar

To be fair to the developers, they do elaborate a little further in the comments:

Hey everyone, We appreciate the sudden enthusiasm for our game. When we launched it in 2015 into early access and 2016 into full, we were at the vanguard of asymmetrical games. It was exciting, but it was also our first step down the Dunning Kruger curve. QL has bugs that we cannot fix, shaky net code and overall sloppy design. We left the game up for this long so that players who had friends that wanted to play, could still get a copy. However it has been 9 years with minimal to no activity. So we felt it was right to remove it now.

I don't know enough about this game or it's community to comment much, but the devs don't seem to be bad guys - seems like a story of naive developers making a mistake, but doing their best for their community with what they had. For a niche online game with no DLCs, 9 years is hardly a bad run.

laughterlaughter ,

it’s community

its* community

JoeBigelow ,
@JoeBigelow@lemmy.ca avatar

Thank fuck your hear too correct him, I didnt understand what he meant because of the typo!

DAMunzy ,

Ouch!

Nice ones.

laughterlaughter ,

You’re welcome.

iAvicenna , in Brace Style
@iAvicenna@lemmy.world avatar

weird cousin of lisp

alcasa , in Brace Style

That would be very cool to have in a code autoformatter

  • All
  • Subscribed
  • Moderated
  • Favorites
  • [email protected]
  • random
  • lifeLocal
  • goranko
  • All magazines