/dpt/ - Daily Programming Thread

What are you working on, Sup Forums?

Previous thread:

Attached: XilsKrW.png (1024x1024, 112K)

Other urls found in this thread:

plg.uwaterloo.ca/~cforall/features
developer.mozilla.org/en-US/Add-ons/WebExtensions/API/tabs/getCurrent)
insights.stackoverflow.com/survey/2017#top-paying-technologies
twitter.com/NSFWRedditGif

plg.uwaterloo.ca/~cforall/features
>C∀ (C-for-all) is an open-source project with the goal of extending ISO C as a non-object-oriented programing language.
C27 is already here, guys.

Attached: turing-bg.png (120x182, 10K)

So this is to C what Kotlin is to Java?

[pic related] is what acceptance of Rust looks like.

Attached: rust-programmer2.jpg (512x512, 77K)

Actually, that's the depression stage. A Rust programmer in the acceptance stage looks like this.

Attached: rust-programmer.jpg (852x480, 41K)

Reposting
I'm just getting into JavaScript and am making my first addon. For some reason, whenever I try to get the current browser tab using browser.tabs.getCurrent() it always gives me this crappy [object Promise] message where I should have the info about the tab.

Looking at its mozilla page (developer.mozilla.org/en-US/Add-ons/WebExtensions/API/tabs/getCurrent) they say it should be run on an options page, otherwise it will return undefined. I tried that and still got the same message. Is [object Promise] considered undefined? I'm somewhat at a loss.

Attached: 1506338998817.jpg (680x680, 53K)

>variable overloading
holy fuck who thought any of this shit was a good idea

You will have to learn about Promises. They are retarded javascript asynchronise bullshit that are a huge boner killer. Basically the function returns an object you need to call a .then() on or something.

Looks like a bunch of useless bloat.

pretty neat

short int MAX = ...; int MAX = ...; double MAX = ...;
short int s = MAX; int i = MAX; double d = MAX; // select MAX based on left-hand type
nope

How do I git gud at Haskell?

struct wtf
{
int max;
short max;
double max;
};

what's the problem

I'm at halfway into tutorials still can't fizzbuzz

>What are you working on, Sup Forums?
Still messing around with shaders. Making some progress and cleaning some things up.

Attached: scrot.png (1920x1080, 726K)

fizzBuzz :: Int -> String
fizzBuzz n
| n `mod` 15 == 0 = "FizzBuzz"
| n `mod` 5 == 0 = "Buzz"
| n `mod` 3 == 0 = "Fizz"
| otherwise = show n

Uh..that's wrong

C++17 is better.

Ever notice how every piece of Haskell/Idris/Agda code ever posted ITT has been fizzbuzz/Peano/Rock-Paper-Scissors etc.? It's almost as if the primary use of FP languages is fizzbuzz.

extending c is idiotic. c is obsolete and doesn't need to be extended for what it's still being used (legacy maintenance).

nice selective memory.

Is it even implemented yet

>s-s-s-selective
Either you're new here, or a butthurt little Haskeller. Find me an example of non-fizzbuzz code written in one of your meme langs in the archive.

lurk more wagecuck.

just started pic relate

merge :: Ord a => [a] -> [a] -> [a]
merge [] [] = []
merge [] (x:xs) = x : merge [] xs
merge (x:xs) [] = x : merge xs []
merge (l:ls) (r:rs)
| l < r = l : merge ls (r:rs)
| otherwise = r : merge (l:ls) rs

mergeSort :: Ord a => [a] -> [a]
mergeSort ls
| length ls == 1 = ls
| otherwise = merge left right
where
half = length ls `div` 2
left = (mergeSort . take half) ls
right = (mergeSort . drop half) ls

Attached: Clrs3.jpg (297x335, 20K)

Is recursion the only way to anything in functional programming?

neither.
just this week there was this guy doing stuff with session types, iirc.
And there's that user that keeps positing proofs he did in Agda. The last one I recall had something to do with lambda expressions.

>n-n-no i'm n-not new!
>non-fizzbuzz haskell code exists here! i just can't show you any
Yeah, that's what I thought, faggot. Keep fizzbuzzing.

Yes

It's fine, one day you'll be able to do a segfault-free fizzbuzz too.
There are better ways to vent your frustration.

>there was this guy doing something i can't specify b-but it's r-related to fizzbuzz types. so it's impressive
>and that other guy wrote some proofs! they had something to do with lambdas
Wow. All those real non-fizzbuzz programs. Doesn't sound like useless type system wanking at all.

pretty much

>i can't write a segfault-free fizzbuzz without compiler hand-holding
>that means everyone else can't do it, either
Typical type fizzbuzzer logic.

>in denial that rust can't be that shit
>angry because rust is really that shit
>maybe there's reason why those features are so shit
>oh, the developers are just retarded
>accepting that you can't write software in rust

how?

what's wrong with recursion?
also you obviously build things out of other things, e.g. map, filter, etc

Programs are just objects from the Fizzbuzz category.

>that means everyone else can't do it, either
Seeing how assblasted you are about fizzbuzz languages, I'd easily guess you had to shoot yourself in the anus at least a dozen times before you could do it.

>Programs are just objects from the Fizzbuzz category.

Attached: 1402211406661.png (447x378, 11K)

Honestly, I'm starting to wonder if you could write Fizbuzz in a context free grammar.

From a basic level yes, but a lot of the time you can just use maps, filters and folds to do what you want.

Promises are javascripts solution to async. Basically it promises a return value but it has not yet been evaluated. Google it, basically the then function is how you deal with it, but if you're working with serval promises then it's best to stack them in a promise queue

I'm so sick about this meme of "real languages who get things done".
Get what done ?! It gets jack shit done except nice presentation websites and UIs.
None of the software researchers use over here, written in your stupid realmen's languages support any kind of parallelism or even use the GPU for very heavy calculations. The only ones that do, contribute to the buggy/bad reputation of (F)OSS. We're stuck having to buy CPUs with the highest possible frequencies. Or we try to teach some of the less tech-illiterate a programming language.

But async is in Javascript too.

>I'm so sick about this meme of "real languages who get things done".
>Get what done ?!
Are you using a browser or an operating system, user? Do you have a video/audio player installed? Do you ever play video games? Do you use an IDE? How much of the software you use is written in a FP meme language, Fizz Buzzington?

How is FP a meme?

>n-n-nothing gets done in actual, useful programming languages!!
>gets immediately BTFO
>can't respond
>desperate deflection ensues

Are you mentally retarded? I'm not the guy you think you're responding to. Take your fucking meds.

>responds to a conversation between two other posters
>does nothing to indicate he's a different poster
>gets absolutely ass-destroyed when he gets mistaken for the other FP memer
>u-u-u dumm!!!

g++ and clang++ already implemented it before the final draft was approved

idc about how FP isn't popular.
The few software I use in FP languages are ten times less likely to bug on me.

Most of the use-cases you quoted don't leave you any choice to use an imperative language. That doesn't make it good. It's utter shit, garbage !
I don't care how much more your garbage is used compared to toy languages. Fact is the majority of developers are a bunch of lazy fatfucks who either can't write software correctly or get with the times.
>Muh efficiency and manual memory management
he says while doing everything on a single thread because he can't into bugfree concurrency in his shitlang.

>The few software I use in FP languages are ten times less likely to bug on me.
The "few software" you use "in FP languages" are also 10 times less complex. In any case, no wonder you can't master a real programming language if you can't even get a grip on English.

I'm not a programmer, you fucking moron.
I'm complaining because stubbornness and inability of shitstains like yourself make my department spend 500K a year.

>if you can't even get a grip on English.
That's all you can resort to ?
>unironically taking the time to master a third-worlders' language.
I might consider it the day an average seniors' salary is as big as high as the average juniors' over here.

>researches make shit software
>this is somehow the language's fault
also the massive parallelism of GPUs is rarely useful outside of things like rendering graphics, machine learning and mining buttcoins

It's still being used to write embedded software. C is embedded in that domain.

Is it bad practise to use a while loop to repeat a boolean function with no body?

Something like
while(booleanFunction()) {}


The boolean function is going to remove things from a list and return false when done. I just need it to repeat until it is false. This seems like the easiest way but looks really dodgy

Is it fine?

>I'm not a programmer
Then your uneducated opinions are irrelevant.

>stubbornness and inability
You mean your stubbornness and inability to provide any evidence that the memes you keep shilling for are practical?

>my department
"Mommy's helper" is an entire department now? How many brothers do you have?

>zero replies back on internship applications
>still in waiting on replies for my masters applications

I'm not going to make it

Attached: 6XIv4Tg.gif (220x165, 318K)

>Is it bad practise to use a while loop to repeat a boolean function with no body?
No, but it may be bad practice to have such a function in the first place, depending on the context.

You have do {} while (...); for that.

>65232117
Sure. What's next ?
Only video games use vectors or matrices ?

(You)

>You have do {} while (...); for that.
What difference does it make?

It's not very nice. Split that function up into a function that only does the check and returns a bool, and a separate function that only performs the side effects.

By that I mean that you can replace your function with a do while loop, not that do {/*nothing*/} while (boolean_function()); is better than while (boolean_function());

See

What's the hub-bub about Rust anyway? From my quick looksee it just looks like another Java/Kotlin/C# derivitive.

I'm an oldfag & we used to chant "don't re-invent the wheel"

Seems like wheel re-invention to me

>n-n-nothing gets done in real programming languages!!
>except for almost every piece of software i use
>b-b-but the two toy Haskell programs i have on my computer don't have as many bugs as real software!
>n-no, i can't provide any evidence that complex software written in meme FP langs under real-world constraints is less buggy
>i'm not a programmer but muh onions matter
Holy fuck... what a loser.

What languages that have seen actual real-world use are golfing-friendly? Perl is the only one I can think of.

> you can replace your function with a do while loop
Do you understand why functions exist in the first place?

Its a reddit language for redditors what do you expect

It's nothing like Java. It's an attempt to bring high-level constructs and type safety in the world of high-performance, real-time and embedded domains without compromising performance.

>It's an attempt to bring high-level constructs and type safety in the world of high-performance, real-time and embedded domains without compromising performance.
You mean it's an attempt to bring webdev soyfriends to the world of high-performance, real-time and embedded domains without compromising the entire field of computing.

Nigga, Java's downright painful to program in compared to Kotlin and C#, oldfag my ass.

Curlylang faggots can't write a loop with the loop condition in the middle of the loop body without having it look like utter shit

(while (do ~part1 ~condition) ~part2)

while (1) { // ugh
@part1@;
if (not @condition@) // uuugh
break; // uuuuuuugh!
@part2@;
}

>You mean
No.

>soyfriends
Fuck you, soy kicks ass.

>bring webdev soyfriends
I can't see any correlation between webdev and rust desu.
Except the soy. But "soyfriends" would have sufficed.

>soy kicks ass.

Attached: 1518641929727.png (800x750, 106K)

Why are you so hellbent on securing the existence of boolean-returning subroutines with side-effects?

You forgot to add the avocado toast.

Be more subtle next time.

C was obsolete at the time of its release. Billions of man-hours, dollars and thousands of lives have been sacrificed on the cursed language Unix foisted on us all. Stallman should have never included it in the GCC, let alone START with it. I can only assume he did it as revenge for the world ruining the AI Lab. Never fuck with a Von-Neumann-Class Autist.

Those Military-Industrial Complex cunts sat on the Ada compilers and wouldn't let the world flourish on a superior imperative systems language. Worse is better, welcome to hell.

>type safety
>webdev

Congrats, you went full retard.

What is PureScript

>I-I-I-I s-sure showed him this time !

>Why are you so hellbent on securing the existence of boolean-returning subroutines with side-effects?
Who said whatever his procedure does only happens in that one place, or that whenever it's used, it's used in a loop like that?

Something no one uses.

What is Fintech, and why do they pay so much for Scala and F# programmers?

Beware the C autist.

>gets completely destroyed
>can't address any of the aforementioned points
>m-m-maybe if i act really smug, no one would notice that i got BTFO

What is TypeScript

>they pay so much for Scala and F# programmers
Call me back when you get your Scala job, kiddo.

insights.stackoverflow.com/survey/2017#top-paying-technologies

You know how I know you're a 19-year-old NEET?

gb2 javascript, kiddo.

again, it takes very specific applications for it to be worthwhile to use gpus for vectors and matrices

>c-c-companies only make CRUDs

>You know how I know you're a 19-year-old NEET?
You know how I know you're projecting? Because you clearly didn't look at the "Most Popular Languages by Occupation" chart in your own source. Go look for Scala and F# and then come back and tell me all about how the industry takes your memes seriously.

Looks like it stands a chance to gain a foothold, but it's got its own issues: First, it carries M$'s stigma, and "errors" behave like warnings, and lots of shops simply ignore warnings.

Maybe once WebAssembly matures a bit, then there may be such a thing as "typesafe webdev".

Mea culpa, actually they pay the most for CLOJURE.

Year of the LISP NOW BITCH

I'm making a computer game

See , faggot. As I said, call me back when you get your F# job. Or any job, for that matter.

if you stopped posting dumb people, you would do better