13
galena
1y

if(amount !>= 0){ }

Comments
  • 3
    You know what, sure, I'll take it. But then drop the parens too.

    if amount !>= 0 {

    }
  • 0
    I never understood why the CTL operators A and E prefix expressions and not operators. `AG p`, `EX p`, `AF p`, these work either way because G, X and F are prefixes themselves, but `p U q` is an infix and IMO the natural way to extend it to CTL would be `p EU q` and not `E(p U q)`which is the standard form.
  • 3
    I had a similar thought for my own programming language.

    Why not allow `obj.!is_foobar()` instead of `!obj.is_foobar()`

    Also Zigs postfix dereferencing (`obj.*`) is pretty nice!
  • 2
    if ( !(amount >= 0) );
  • 4
    @12bitfloat do you know any language that allows this? It looks nice.
  • 3
    @12bitfloat that's a cool idea, I may steal it in some form. After a bit of thinking, I think it plays perfectly with Orchid's existing preprocessing capabilities, and it can accommodate this syntax abomination which computes the negative normal of a vector with a dynamically dispatched function and shadows the original (FP loves shadowing):

    let direction .-= normalized

    This is of course not intended use, but both of these are:

    let direction .= normalized
    direction.-normalized

    and there's no point in artificially limiting how deep these can stack as long as the ordering of the modifiers is unambiguous.
  • 4
    Surely this won't produce an undecipherable mess of abstractions that say less than they should like Haskell did. Maybe I should stick to practical FP since the niche of impractical metaprogramming circlejerk is already overfull.
  • 2
    If (amount < 0) { }
  • 6
  • 4
    If (amount >=0)==false {
  • 4
    why do i feel like going to dfox's house in US, go into his server room and burn the memory disk that is hosting this post and associated comments? i am not that violent
  • 2
    @Lensflare Sadly I don't
  • 2
    @dotenvironment yeah, definitely not violent at all given your recent rant
  • 2
    I like the idea because it would allow
    if collection.!isEmpty
    to read as "if collection not is empty"

    vs
    if !collection.isEmpty
    "if not collection is empty"

    both are wrong but the first one feels less wrong 😄
  • 0
    @Lensflare You can also define an object for all sorts of boolean attributes and instantiate it on objects as "is" so you can have

    array.is.!empty
  • 0
    @Realjase probably by pure inertia. a line does not feel complete without ';'. I catch myself here and there wanting to put it in normal text ( mainly @ work ) so it compiles better from the receiving side :D
  • 0
    @Lensflare combination of comparison operators seems to be an anti pattern.
  • 0
    @Realjase it should work in C, C++, and C#. The semicolon after the condition is an empty statement. I used that in place of the empty block used in the OP.
  • 0
    @Realjase it's legal but hopefully you have configured your compiler to error out because of it since the semicolon is easy to overlook.
  • 2
    @electrineer aorry, the cringe was unbareable
Add Comment