So...?

So...?

Attached: why.png (576x590, 42K)

Other urls found in this thread:

hooktube.com/watch?v=HddFGPTAmtU
phoronix.com/scan.php?page=article&item=gcc9-eoy-2018&num=1
phoronix.com/scan.php?page=article&item=gcc-clang-2019&num=1
phoronix.com/scan.php?page=article&item=power9-gcc-clang&num=1
phoronix.com/scan.php?page=article&item=gcc9-clang8-hedt&num=1
phoronix.com/scan.php?page=article&item=gcc9-core9-tuning&num=1
gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html
godbolt.org/z/8DPXTd)
twitter.com/SFWRedditVideos

// If you write it any other way you're a bad programmer
if (0 < x && x < 10) {
// ...
}

1/10 made me reply

My guess is it would be a headache to add parser rules for that. Also 30 years ago it would probably be difficult to do this. So they did it the former way and it just got stuck.

Because that's retarded?

If anything they might consider supporting 0 < x < 10 it's not really the same thing (if you wrote 10 < x < 0, what do you want it to do? return false? throw an error?). Why complicate it?

today we have type inference, why can't we have condition inference as well?

Attached: 1566211723405.jpg (700x957, 70K)

it wouldn't work, the same way (0 > x && x > 10) wouldn't work. There isn't really a valid reason why 0 < x < 10 shouldn't be shorthand.

itt: retard that can't into rvals and lvals

if (Enumerable.Range(1,9).Contains(x)) {
// ...
}

What does "not work" mean? 0>x && x>10 works. It is a perfectly straightforward logical map which will always return false (unless for some reason x is mutated mid-process).

But 0 > x > 10 is not merely false; it is an improperly constructed system. I would say that it should throw an arithmetic error. And who wants that?

Just learn to use conditionals. It would be extremely easy to make 0 < x < 10 a thing, but nobody does. That should tell you something.

Some languages have tried various ways to support 0 ∈ (0,10) type syntax, but honestly I never use them because I don't want exceptions, I want falses.

Because that does not produce a syntactically valid expression tree like above:
&&(>(x, 0), (x, 0),

The lexer could easily reduce that to
(0 < x) AND (x < 10), but the problem is race conditions.
sqrt(x) < x++ < y = x

>rval and lval on conditional operators

nu-languages were mistake

It wouldn't be an arithmetic error. It would ask the question, is x less than 0 and greater than 10? Plug in any value for x, and the answer would be false. It would return false, the same way our current syntax does it.

Cnile cope lmao

What's wrong with it, it's almost plain English. Much better than an arbitrary combinations of words like 'int i = 0', 'vector::_iterator_type::_MyValue' and other garbage

Swift is based tho...

In Scheme this is just
(if (< 0 x 10)
...)

HolyC has 0

>< 0 x 10
???, that doesn't even make sense.

if x in range(0,10):

Attached: 1539918281973.png (859x960, 229K)

< is a variadic function. (< x y z w) is equivalent to x < y && y < z && z < w in C semantics. It's perfectly natural when you get the hang of it, and it works the same as other variadic primitives.

Prefix notation

If you really need it to be that way, use the typdef

we should have adopted unambiguous lisp prefix notation. just like we should have adopted dozenal.

Python has 0 < x < 10 syntax though. Chainable comparatives.

How is that the lexers task, are you retarded?

because who knows if you meant x < 10 or 0 < 10.

in lisp you can:
(when (> 10 x 0)
;;your code here

)

Attached: 141431988125.jpg (141x161, 4K)

In Javascript you can also use ||
if (0 < x || x < 10) {
console.log('see this works too')
}

Are you a complete retard?

x = -1

>javascript "programmer"
>complete retard
pick two

Actually, doesn't work... You want it to return true if the number is between 0 and 10

with your code, if your number is between 0 and 10, it returns true. However, if it's less than 10, the second check will return true because it's less than 10... In short, it doesn't work.

Read

And yet Python is slower

Keked

>this fucking thread
why do I still come to this place

Attached: 1563511651142.png (256x310, 20K)

I believe you can do something like that in HolyC.
Something like if (0 < x < 10)
Can anyone confirm?

Attached: unnamed.jpg (900x900, 151K)

if (10 > x === true && 0 < x === true) {
console.log ("FUCK YOU'RE CODE NIGGER")
}

You can do that in Python

Retard.
if (!(x < 0 || x > 10))
Would work though.

>t. Someone that has never written a line of JS in his life

if (0..10).contains(&x) {
println!("zero cost abstractions");
}

>>> x = 4.5
>>> x in range(0, 10)

It evaluates to False

Why not (0 < x < 10)? Python supports it.

I don't see why lhs couldn't be inferred in the case of (x > 0 && < 10). Sure, it would be syntactic sugar, but in longer more complex predicates it would be handy.

x > 0 && < y && % 2 == 0 or whatever

lhs inference is possible. Just take any binary operator and if the rhs begins with a binary operator feed it the lhs of the operators lhs. Not even difficult.

Language design has come a long way since yacc and lex mate.

The parser just has to evaluate ??? -> x. Even xml can handle this.

Imagine all the allocations just to compare two integers.

The outcome is less readable code. It works fine for one value, but in most real-life scenarios you are using much more than that.
a > 10 && b > 0 && < 10

Also validators exists - nice abstraction, well readable, useful and extendable that does exactly what you want.

because how you you code the following
boolean istrue = true;
if(x=0 || istrue)
you are just as retarded as you guys should quit programming before everyone is your lifes makes fun of you

slippery slope mostly, when you support syntactic sugar in the core of your language eventually you get so much of it none of your language looks the same syntactically and you have to remember more and more rules. the idea is to make everything look similar with as little differences as possible to denote different function to make it extremely easy to infer the different parts of the language. if you have 3 special rules for expressions and 6 special rules for functions and 9 special rules for classes it stacks up into not being able to ever know the language fully.

0

It should be
if( 0 < x < 10){
doThing()
}

also see

It should be

if(0

what's wrong with it ? It's way too complicated for something that simple. This kind of shit is why we end with faster hardware than few years ago but slower software.
imagine creating a whole library or something equivalent just to find out if some number is odd or even. That would be stupid

Who cares, optimising compilers are insane nowadays, they make better optimisations than humans can in the general case. Especially now with C++ concepts, compile times will be decimated and compilers will have plentiful hints for optimisations. If your asymptotics and data structures are chosen correctly, everything else is the compiler's job.

How will concepts reduce compile times? You can already SFINAE.

I don't think that's a valid argument considering there are plenty of languages that use aliasing. Eg vb.net 'with' constructs.

Besides that, smaller code is almost always more readable. Removing ambiguity and questions also increases readability.

for some languages yes, maybe, but I'm pretty sure not all have good compilers.
Also, if someone program like that for such simple things, I'm sorry but I'll worry about how he will program in general and on bigger projects. I'm pretty sure that's because of people like this you end with bloated shit.

xml can parse references, there are already language constructs that require lookahead.

Think about how many ways there are to implement something like properties in most languages. Adding extra rules actually increases readability. When you see a public attribute you aren't wondering about validation, when you see an auto property you understand what it does immediately. If it was all implemented with the "more general" solution of using methods then you would always be wondering what they /actually/ do.

If statements, for loops, while loops, do loops, switches, etc, they are all syntactic sugar for jmps. Can anyone argue that for loops are less readable than gotos? Can anyone argue that if statements should never have been added to high level languages because of the risk of 'slippery slopes'?

Ultimately 0 < x < 10 is more readable than x > 0 && < 10 which is more readable than x > 0 && x < 10. It doesn't matter that it is a special case, because the fact that it is a special case is what increases readability.

Template and 'auto' type deduction is slow as shit and SFIAE evidenced by overly cryptic error messages and false positives. E.g. >class circle has-a draw() //on screen
>class cowboy has-a draw() //gun
Both will fit a template that calls .draw(), which is a semantic error.
Please watch this talk:
hooktube.com/watch?v=HddFGPTAmtU

>not all have good compilers
Well if you use c, c++, java, javascript, python, ruby, prolog (mercury), php, you have access to very well-made and currently developed compilers/interpreters.

You can specify exactly as much semantic detail in a SFINAE failure as you can in a concept. Only difference is nicer syntax. Is there any part of that talk which demonstrates any compile time improvements?

>x > 0 && < 10 which is more readable than x > 0 && x < 10
No, it isn't
It looks utter shit

>Well if you use c, c++, java, javascript, python, ruby, prolog (mercury), php, you have access to very well-made and currently developed compilers/interpreters.
Do you have any articles that talks about it and actually prove that yeah you can code however you want, compilers is here for you ? Genuinely asking

Because after && the compiler is looking for a valid statement that evaluates to a boolean even if it stands on it's own.
It's the reason you can do stuff like
if (x > 0 && someOtherBooleanFunction())
{
//do shit here
}

>optimising compilers are insane nowadays
bait 10/10, makes me REEEE every time

What about 0 < x < 10?

>they make better optimisations than humans can in the general case
also >optimisations
REEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE fucking shameless code monkeys

He doesn't show concrete numbers because these are WP drafts, but concepts are simply a compile-time collection of predicates, which can cut the decision tree early in the deduction. Templates can go deep, past the compilation stage and into linker errors.
I can show you some optimising compiler benchmarks if that's what you want. I can provide you material on what types of optimisations they do and you can see if you can do all of them by hand.
I'm not autistic, I write code that is semantically correct, and the compiler does the rest. There are no algorithms for minimising turing machines, so it's a dead pursuit - I'm not that autistic.

aliasing is good because it's explicit, it removes possibility for mistakes, and it makes reading faster.

Think about a non trivial situation like:
foo.bar.foobar().x > 0 && < 10
vs
foo.bar.foobar().x > 0 && foo.bar.foobar() < 10

When you read the former you know that the lhs of >0 and

>I can show you some optimising compiler benchmarks if that's what you want. I can provide you material on what types of optimisations they do and you can see if you can do all of them by hand.
keep posting

Who gives a fuck. I don't get paid to optimise code, there is no such profession. If it's a problem, stop using single board computers and thinkpads retard, you can get a i7 6700 and gtx titan equivalent laptop nowadays.

Concepts have been implemented in GCC for a while. SFINAE errors take place at the same place in the decision tree as Concept failures - when evaluating the template function's signature.

>xml can parse references
>Implying xml is any good and can be used as a good example.

>I don't get paid to optimise code, there is no such profession.
yes there is. That's basically being a programmer and not a code monkey

That's the point.

xml isn't good but apparently it's better than whatever compiler you are talking about.

Are you really going to let xml parsers shit all over your compiler? "It's too hard to parse" is bull.

phoronix.com/scan.php?page=article&item=gcc9-eoy-2018&num=1
phoronix.com/scan.php?page=article&item=gcc-clang-2019&num=1
phoronix.com/scan.php?page=article&item=power9-gcc-clang&num=1
phoronix.com/scan.php?page=article&item=gcc9-clang8-hedt&num=1
This is a good one:
phoronix.com/scan.php?page=article&item=gcc9-core9-tuning&num=1
Here are flags:
gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html
This is for C/C++, you can do the same on other languages yourself friend.
I'm not a "programmer", I look at mathematical publications, rewrite the pseudocode on the white board, then give it and the header files with lots of comments to the "programmers". It's entirely their job to write their pixie dust turing machines.
Every moment you spend optimising code you could have spent on automating that for the future and making it open source.

>sqrt(x) < x++ < y = x
Any sane language shouldn't even allow such an abomination.

Indeed, it's a race condition. But C/C++ are totally fine with this.

>AND is the same as NOR
kek

Compilers are getting better as time pass, but having a retarded way of doing things such as is still retarded and won't be optimized compared to something like if(x > 0 && x < 10) { . There's a limit to compilers.

Attached: 1566373694890.png (828x801, 149K)

Why? < has clearly defined priority, you simply have to choose left or right associativity (left is the obvious choice) such that:

It breaks the scope and makes && operator ambiguous.
It's supposed to fix problems when a long chain of predicates are checked, but it only makes it worse if you change anything.

>It's objectively better in the same way that if-then-else and do-while are better than gotos.
It's objectively worse in the same way that braceless 'if's are objectively worse than braced ones.
Could very easily break if there was a multi-line chain of predicates and someone deleted the line with variable being checked, but didn't retype the variable on the next predicate.

Though most of its problems could be fixed by not pretending it is the same as && operator.
If it had its own symbol, say @ or @@, it would not be misleading and would explicitly tell the programmer
>continue reading, you can't just treat this expression as self-contained

I mean, n is a constant number here, n = 9. In future C++, you ought to define what I did to be valid for all containers with the linear_order concept. Forget that, STL containers all have their own .find(), so this operation would be θ(c) on unordered_set, unordered_map. Hence had you chosen the correct data structure, you would have gotten the best performance.

I gotchu senpai
λ> and . sequence [(>0), (

inb4 it takes 20ms to run

That's not a race condition, that's an undefined sequence because there is no sequence point. Race condition means that two things happen at the same time such that the output depends on which one finishes first. What this is, is that the order of modifying x is undefined because there is no sequence point. The order that the operations happen in will always happen the same way in a single compilation, but the order that they happen won't be defined, may be surprising, may not actually do what you think it will do, and may differ between compilers.

Doing those things can totally be optimized and often are. In Rust it is (godbolt.org/z/8DPXTd)

// Type your code here, or load an example.
pub fn contains(x: i32) -> bool {
(1..10).contains(&x)
}

when compiled with optimization on becomes
example::contains:
add edi, -1
cmp edi, 9
setb al
ret

In Java and C#, the compiler often optimizes these things out, and will sometimes even do so JIT.