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.

lurch , in ifn't

i assume “ifnot” wasn’t edgy enough and makes inferior noises on custom mechanical keyboards? /s

OpenStars , in ifn't
@OpenStars@startrek.website avatar

Please God let this be a humorous post that somehow does not also find a way to manage to come true…

jtk ,
@jtk@lemmy.sdf.org avatar

I would have bought it if they said ifnot instead, it’s the same number of characters and wouldn’t require a major parser overhaul to support keywords with a ’ in the name.

OpenStars ,
@OpenStars@startrek.website avatar

Yeah, to be clear, I don’t like it, I don’t like it one bit:-P.

jaybone ,

If not anybody have time for that.

OpenStars ,
@OpenStars@startrek.website avatar

ifn’t

Oh dear Lord what have I done!? :-P

pupbiru ,

i mean, “unless” tends to be the usual term for an “if not” keyword in languages that implement such a thing

Fal ,
@Fal@yiffit.net avatar

Which is awful and incredibly confusing. I hate ruby

msage ,

And Perl

NigelFrobisher ,

And my axe!

frezik ,

I find that you need to choose carefully when to use it. Simple cases tend to be alright. Larger, more complex conditions shouldn’t touch it.

pupbiru ,

totally agree; just saying that if it’s GOT to be something, that something should probably be unless… unless . . .

AlmightySnoo , in ifn't
@AlmightySnoo@lemmy.world avatar

reminds me of #ifndef instead of #if !defined(…)

the_of_and_a_to , in ifn't

deleted_by_author

  • Loading...
  • JPDev OP ,

    unlessn’t

    Goun ,

    I’m sorry, I hate the “unless” so much

    NotSteve_ ,

    At one of my first jobs, I was tasked to rewrite a bunch of legacy Perl scripts in Python and the unless lines always made me trip up. I don’t know why but it really messed with my mental flow when reading Perl code

    chaogomu ,

    Basic used "else".

    It's nice. "if", "then", and "else". I spent a year programming a shitty roulette game on an Apple 2e back in high school. I still remember the joy of using if/then/else paired with goto to make a horrible mess of spaghetti logic.

    But yeah, "else" is nice.

    Deceptichum ,
    @Deceptichum@kbin.social avatar

    Let's just scrap every language except various forms of BASIC.

    pearsaltchocolatebar ,

    Please God, no. I had to unravel terminal scripting code that was written in some propriety BASIC language with basically no documentation.

    Took me a chunk of time trying to figure out how it worked before I made the realization that it was BASIC

    jaybone ,

    Try PL/SQL.

    SubArcticTundra , (edited )
    @SubArcticTundra@lemmy.ml avatar

    Using a standalone ‘else’ would tickle my brain in the same nice way that being able to declare a variable inside an ‘if’ statement as if it were a ‘for’ loop (which you can do in modern C++) does.

    Amaltheamannen ,

    Or a rust “if let”

    SubArcticTundra ,
    @SubArcticTundra@lemmy.ml avatar

    Ooh yes. Rust is king when it comes to this sort of inline stuff. Inline match. Mmmmmm!

    jaybone ,

    Block scoped variables are bad?

    SubArcticTundra ,
    @SubArcticTundra@lemmy.ml avatar

    🤷‍♂️

    Lmaydev ,

    Many languages let you scope variables.

    In c# you can create an arbitrary scope to declare variables in. Most likely in others as well.

    SubArcticTundra ,
    @SubArcticTundra@lemmy.ml avatar

    Ah clever, didn’t think of doing this. Not having to encapsulate if statements in scopes would still look cleaner though

    Lmaydev ,

    It’s handy if you’re creating temp variables for single use that you don’t need to use again.

    Although I admit I’ve only ever done it a couple times lol

    Again in c# you can omit the scope and only the next statement is part of an if or loop.

    marcos ,

    The Perl version of it is even greater!

    EnderMB ,

    I haven’t written any Ruby for years, but I still praise it in every conversation I have regarding programming languages. It’s basically a much simpler Python, with some design ideas that are both beautiful and deeply strange.

    OskarAxolotl ,

    Ruby was designed to evoke joy and they absolutely succeeded. Usually, programming is mostly a means to an end to me. But using Ruby just feels so amazing, it’s almost impossible to even describe to somebody who has never used it before.

    vlad76 , in ifn't
    @vlad76@lemmy.sdf.org avatar

    What’s wrong with “else”

    NekkoDroid ,
    @NekkoDroid@programming.dev avatar

    It’s not ifn’t

    SpaceNoodle ,

    *it’sn’t

    felbane ,

    I’dn’t’ve said it like that.

    Scubus ,

    Perchance

    NocturnalMorning ,

    ^This

    OP raises a valid point

    Darkassassin07 ,
    @Darkassassin07@lemmy.ca avatar

    if(condition) {#block never used} else {#actually do a thing}

    Vs

    ifn’t(condition) {#actually do a thing}

    Vs

    if!(condition) {#actually do a thing}

    gandalf_der_12te ,

    vs

    if (not condition) {#actually do a thing}

    MNByChoice ,

    Cannot start a statement with else. One can with ifn’t. There is a new thing where we don’t branch (which is a separate discussion).

    Or am I missing the joke…

    ivanafterall , in Sometimes things do go your way
    @ivanafterall@kbin.social avatar

    Another version of this is unexpectedly finding some niche, single-developer software tool that does precisely the thing you need, all because some genius angel stranger (strangel?) from the internet happened to encounter the same problem, and somehow knew how to fix it.

    4z01235 , in Sometimes things do go your way

    I just went through this exact process (not for the first time) two weeks ago with a bug in the golang standard library. Fun times. Deep in the dependency stack of a container build my team doesn’t own so who knows when I’ll get a fixed version.

    voight , in DO NOT MERGE
    @voight@hexbear.net avatar
    lugal , in Sometimes things do go your way

    Your deadline is tomorrow

    Dempf ,

    Time to compile it myself.

    lugal ,

    I’m tired, I thought it’s published next week

    bleistift2 OP ,

    Time to write a ‘Known limitations’ section.

    NegativeLookBehind , in DO NOT MERGE
    @NegativeLookBehind@kbin.social avatar

    Nice

    aMockTie , in DO NOT MERGE

    Why did they submit this as a pull request in the first place? Just commit it to a WIP branch until it’s ready to merge. Am I missing something?

    brisk ,

    Probably to get some other benefitof the PR system, such as CI tests

    leds OP ,

    Does gerrit have a draft state? In azure devops you can mark PR as draft , won’t trigger any builds but you can still start them manually

    beeng ,

    manually

    This is probably why the dev created a PR, less clicks

    sf1tzp ,

    I don’t remember if it did when I used it. Our convention was to -2 your own change until it was ready to go 😅

    DrJenkem ,
    @DrJenkem@lemmy.blugatch.tube avatar

    It’s been a while since I’ve worked with AOSP, but I had always understood it to be some weird shit with Google’s internal processes. The “do not merge” commits are all over the AOSP, or at least they used to be.

    NotSteve_ ,

    I do this often. It’s useful if you want to send it to your coworker for some early feedback or as others have said, have the CI run

    leds OP , in DO NOT MERGE

    But thanks for keeping my phone up to date, it is appreciated ♥

    infinitevalence ,
    @infinitevalence@discuss.online avatar

    Same, I run 3 devices all on Lineage and its great. Who know that you could still get updates and support for a device from 10 years ago, suck on that apple.

    DreadPotato ,
    @DreadPotato@sopuli.xyz avatar

    It’s just kind of sucks that updates consistently breaks banking apps and other stuff relying of passing safetynet. Every time I update I have to do the Magisk workaround again which is really annoying.

    zemja , in WDYM your terminal isn't a test suite?

    Can somebody please tell me what history -c is?

    akdas , (edited )

    It lets you clear the bash command history, either completely or selectively. Here’s the GNU docs for the history builtin: www.gnu.org/…/Bash-History-Builtins.html#index-hi…

    (I’m not too familiar, someone else can clarify: is this available outside bash?)

    What’s interesting to me is the -a option, which lets you “flush” the history for the current session without ending the session. I can see that being useful!

    survivalmachine ,

    history displays a list of all commands you have run on the terminal since the history list was last cleared. It is invaluable for referring back to a big complex command or set of commands you ran at some point in the past. The -c flag clears that history.

    zemja ,

    Fuck, I just cleared my history.

    umbrella ,
    @umbrella@lemmy.ml avatar

    dont you also need history -w to save it?

    on ubuntu -c doesnt actually clear it unless you also use -w

    survivalmachine ,

    Yes, my comment only applies to the shell history in memory. -c clears history immediately, but you can still reload it from disk if you haven’t overwritten that with -w. If you tend to close your terminal windows frequently and rely on the history feature between sessions, it would benefit you to learn about the intricacies of the on-disk copy of history and how its affected by writes, appends, clears, crashes, etc. I tend to leave my terminal windows open a long time and copy any complex commands out to my PKM if I need to save them for future sessions, so I generally try not to rely on .bash_history, but it has saved my bacon on more than one occasion.

    caseyweederman ,

    What does it do again?

    survivalmachine ,

    🤣

    allywilson , in WDYM your terminal isn't a test suite?

    I just start every command with a space, don’t see the issue.

    mumblerfish ,

    Was working on a server where I did not want to put some dumb command into the history, so I add a space like you do. Press up. The command is there. The fucking insult I felt.

    PoolloverNathan ,

    It’s disabled by default, but you can enable it in .bashrc and then delete that edit session using a spaced command.

    Edit: brain fart

    superbirra ,

    it also depends on the shell, in zsh it persists on local history but does not get written to history file

    Corbin , in The Perfect Solution

    Don’t use OpenAI’s outdated tools. Also, don’t rely on prompt engineering to force the output to conform. Instead, use a local LLM and something like jsonformer or parserllm which can provably output well-formed/parseable text.

    lledrtx ,

    Agree this is better but neither of them actually seem “provable” though?

    Corbin ,

    I’ll be informal to boost your intuition. You know how a parser can reject invalid inputs? Parsers can be generated from grammars, so we can think of the grammars themselves as rejecting invalid inputs too. When we use a grammar for generation, every generated output will be a valid input when parsed, because the grammar can’t build any invalid sentences (by definition!)

    For example, suppose we want to generate a JSON object. The grammar for JSON objects starts with an opening curly brace “{”. This means that every parser which accepts JSON objects (and rejects everything else) must start by accepting “{”. So, our generator must start by emitting a “{” as well. Since our language-modeling generators work over probability distributions, this can be accomplished by setting the probability of every token which doesn’t start with “{” to zero.

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