[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Free Show | Home]

/dpt/ - Daily Programming Thread

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 335
Thread images: 18

File: d lang.png (909KB, 1280x720px) Image search: [Google]
d lang.png
909KB, 1280x720px
What are you working on, /g/?

Previous Thread: >>59246942
>>
>>59251070
"I'm not a fan of religiously taking some idea to the extreme, and I try to be pragmatic in my design choices (but not *too* pragmatic, see the start of this sentence :-). I value readability and usefulness for real code. There are some places where map() and filter() make sense, and for other places Python has list comprehensions. I ended up hating reduce() because it was almost exclusively used (a) to implement sum(), or (b) to write unreadable code. So we added builtin sum() at the same time we demoted reduce() from a builtin to something in functools (which is a dumping ground for stuff I don't really care about :-).

If I think of functional programming, I mostly think of languages that have incredibly powerful compilers, like Haskell. For such a compiler, the functional paradigm is useful because it opens up a vast array of possible transformations, including parallelization. But Python's compiler has no idea what your code means, and that's useful too. So, mostly I don't think it makes much sense to try to add "functional" primitives to Python, because the reason those primitives work well in functional languages don't apply to Python, and they make the code pretty unreadable for people who aren't used to functional languages (which means most programmers).

I also don't think that the current crop of functional languages is ready for mainstream. Admittedly I don't know much about the field besides Haskell, but any language *less* popular than Haskell surely has very little practical value, and I haven't heard of functional languages *more* popular than Haskell. As for Haskell, I think it's a great proving ground for all sorts of ideas about compiler technology, but I think its "purity" will always remain in the way of adoption. Having to come to grips with Monads just isn't worth it for most people." -Guido van Rossum
>>
An app that automatically converts between reddit and 4chan spacing to hide your actual nature
>>
Any language with ⊥ as an inhabitant of every type is worthless.
>>
>>59251080
If Guido hates it, it's probably good
>>
>>59251080
Python is shit, so much is his creator.
Got it.
>>
I'm pretty sure it's against the law to show your political opinion trough the dpt op image you faggot.
>>
>>59251097
It always amuses me when Haskell fags think they will get dependent types as an extension or something, or even better, when they think they already have them.

Meanwhile you can implement CoC in about an hour and you have a more rich type system than Haskell.
>>
>>59251097
Must suck to hate every programming language
>>
>>59251119
what political opinion?
>>
>>59251128
t. haskleler
>>
>>59251150
the correct term is Haskellite
>>
>>59251127
>Meanwhile you can implement CoC in about an hour
In what language?
>>
>>59251173
Haskellyte*
>>
>>59251173
I'm sorry for assuming your demonym
>>
https://github.com/cs01/gdbgui
> A modern, browser-based frontend to gdb
>modern
Why do people think that being browser-based is somehow modern?
The only thing I can parse from that it's additional bloat over gdb with no added advantages.
>>
>>59251180
Anything functional. Bit longer if not.
>>
>>59251127
They can have their dependent types if they get rid of type inference, which will never happen.
>>
>>59251070
replace D lang logo with Rust logo and that pic will be accurate.
>>
>>59251192
>Why do people think that being browser-based is somehow modern?
They don't think that, but they're desperately trying to make others think it, because there's a whole bunch of people who can't program in anything other than JS who want to be relevant. Once WebAssembly takes off there'll be a lot of webdevs without jobs.
>>
>>59251205
There are already plenty of extensions that are undecidable with full type inference, that's not the problem.
>>
>>59251212
But Rust is younger AND more popular than D
>>
>>59251212
>Dfag delusion
>>
D stands for Dead
>>
>>59251233
Rust is a meme language that only few SJW hipsters use. D is alive and well.
>>
>>59251205
>>59251220
Also there is a very powerful fragment of type inference that is completely compatible with dependent types. First, there's bidirectional type checking, where certain terms' types are inferred and others checked (and all inferable terms may be checked). On top of that you have decidable classes of unification like higher-order pattern unification to mop up a lot of remaining cases.
>>
rust is meme
D can't choose if it wants to have gc or no
nim is buggy shit
Chapel is the future
>>
>>59251256
D is a pointless language at this point, it showed promise back when its only competition was 90s C++, but these days it fails to offer compelling advantages over even modern Java and C#, let alone functional languages, while having a GC means it simply can't compete against Rust.
>>
>>59251256
>>59251233
>>
>>59251273
>rust is meme
Not an argument.
>>
How would I type this in python?

(a=b=c) and a = A or a = B
>>
>>59251289
>Not an argument.
Not an argument.
>>
>>59251273
Oh don't worry, eventually D will shed its GC, you just need to wait, honest. Sure they haven't done it despite having had over 15 years to do so, but trust me! One day it will be done! In the meantime you should begin using it despite it being worthless
>>
>>59251306
if ((a == b and a == c and b == c) and a == A) or a == B
>>
>>59251329
Is Python's equality transitive?
>>
>>59251329

Thanks sir.
>>
>>59251273
All the languages are kind of nice but only chapel introduces easier parallel constructs. It's kind of c++ done right with go's promise of easier concurrency except you replace concurrency with parallelism.
>>
>>59251329
>'==' for equality
>'and' and 'or' for conjunction and disjunction, not '&&' and '||'
What the fuck is with these people? Why have symbols for some operators but words for others?
>>
>>59251306
>>59251329
if a == b == c and a == A or a == B
>>
>>59251365
Because equality != identity

a is b != a == b
>>
>>59251365
It is by design.
It produces more readable code.
>>
>>59251397
I disagree vehemently.
>>
>>59251385
This poster is correct.

>>59251329
Ignore my post, anon above is correct.
>>
What language lets me to place comma as a decimal point?
>>
>>59251393
So? Just use triple equals for identity, like other languages.
>>
>>59251275
I'd still much rather use it over either C# or Java.
>>59251320
Who cares
>>
>>59251422
The solution is not to use commas as decimal points.
>>
File: 1421556882136.jpg (20KB, 392x243px) Image search: [Google]
1421556882136.jpg
20KB, 392x243px
>>59251393
>equality != identity
>>
>>59251207
Should add some characters so you can go though r9k mode
>>
>>59251404
Its an absolutely minor point of syntax, a personal preference by the creator that does not matter. Stop complaining.

On the point of readability, I too disagree, also I think that claiming that syntax like this makes python easier to learn is also very incorrect
>>
>>59251439
Fine, you go suck a bunch of D, just don't try to get us to do it too by lying about its utility.
>>
>>59251404
Decades of semantic bugs disagree with you.
>>
>>59251452
We must stamp out this sort of idiocy wherever it occurs before it takes root, no matter how minor it appears.
>>
>>59251461
It's used just as much if not more than Rust
>>
>>59251339
I know C++'s isn't
>>
>>59251080
Oh Guido!
>For such a compiler, the functional paradigm is useful because it opens up a vast array of possible transformations, including parallelization.
Yes.. you're getting there... keep going.....
>But Python's compiler has no idea what your code means
Yess... you're getting a grip now... follow dat train of thought Guide..
>and that's useful too
wot
>>
>>59251483
Disingenuous. That's nothing to do with its merits compared to Rust, and everything to do with it being more than a decade older than Rust.
>>
>>59251425
*language, singular

Also equality vs identity is a useful point. Two lists/strings may easily contain the same elements without being the same object referentially, and this becomes important when you factor in mutability.
Some not so bad ways of handling this:
Scheme: eq? compares reference, equal? compares data
Haskell: == must be defined on a data type for comparison to be possible. For some objects equality shouldn't even be possible (e.g. functions). Referential equality is meaningless in a purely functional language.
>>
File: 1481512059324.png (300KB, 520x800px) Image search: [Google]
1481512059324.png
300KB, 520x800px
>>59251516
>For some objects equality shouldn't even be possible (e.g. functions)
>>
>>59251127
>Meanwhile you can implement CoC in about an hour
Best first determine if You Need The Coc
>>
>>59251516
>For some objects equality shouldn't even be possible (e.g. functions)
Complete rubbish. Look at how Lisp does it. Code is just data.
>>
>>59251506
I only say that because everyone's posting about how dead it is
If we want to talk about merits, D has a very clean syntax, great metaprogramming. The standard library is also fantastic.
>>
>>59251199
What's CoC anyway? In case one wanted to write babby's first, um, y'know
>>
>>59251441
But this solution doesn't answers the question
>>
File: exit vim2.jpg (121KB, 818x536px) Image search: [Google]
exit vim2.jpg
121KB, 818x536px
I wonder if it's possible to become useful programmer if you start learning at 29?

Note that i have just enough knowledge to create webscraper program that finds used cars on a site and displays the results in gui. But most of those things were reverse-engineered, i don't really know any of it
>>
>>59251529
Ever heard of turing completeness?
>>
>>59251549
>great metaprogramming
It's literally just string manipulation.

>>59251551
Calculus of constructions.
>>
>>59251549
>syntax
>metaprogramming
Scheme is better.
>>
>>59251218
Once WebAssembly reaches feature parity with JS (strings, dom, objects all without handing custom FFI/export objects from module to module) ... not seeing that in the next ~5 years, given how slow-paced browser devs are these days
>>
>>59251566
Completely irrelevant.
>>
>>59251544
Lisp doesn't compare functions by comparing the s-expressions, that's idiotic.
Also, I can't think of a single situation where I would need to non-referentially compare two functions without invoking them
>>
>>59251568
>It's literally just string manipulation.
We're not talking about C
>>59251573
>this somehow means D's is bad
>>
>>59251592
Dependent types. Though, aside from definitional equality, function equality isn't mechanically checked, it must be proven using function extensionality.
>>
>>59251544
Lisp has many equality functions. =, EQ, EQL, EQUAL, EQUALP, etc.
>>
>>59251422
In C you can set locale.
see https://www.chemie.fu-berlin.de/chemnet/use/info/libc/libc_19.html
>>
>>59251611
Yes, dependent types, which requires making your language non turing complete. The reason non-referential function equality is meaningless is because of turing completeness.
>>
>>59251559
>>59251634
Fug. I meant something like

float array[] = {3,4,5,6,7};
>>
>>59251634
int array[] = { 3;4;5;6;7 }.
>>
>>59251643
>requires making your language non turing complete.
See Idris.
>>
>>59251643
>Yes, dependent types, which requires making your language non turing complete.
Nope!

>The reason non-referential function equality is meaningless is because of turing completeness.
Just because you can't compare absolutely every function doesn't mean you can't compare the 99% of functions that do terminate or are infinitely productive.
>>
>>59251668
Yes and? Are you just spouting random langauges and paradigms to try to undermine my point?
>>
>>59251652
It's necessary to change syntax to use commas.
>>
>>59251695
>claim
>counter example
>Yes and? Are you just spouting random langauges and paradigms to try to undermine my point?
>>
>>59251672
So function equality is restricted to provably total functions.
And languages like haskell allow every function to be nontotal, therefore its reasonable not to implement equality over functions
>>
>>59251667
Great, now how do you handle multiple assignments/updates in for-loops? You can't use semicolons because they have a special meaning already.

Using commas as decimal points fucks up the whole language. Don't do it. Use the English convention.
>>
>>59251730
>he uses semicolons as terminators
>>
>>59251721
>So function equality is restricted to provably total functions.
Which, in practice, is nearly every function you will ever write and almost certainly every function you will even need to compare in the first place.

>And languages like haskell allow every function to be nontotal, therefore its reasonable not to implement equality over functions
Haskell is garbage.
>>
>>59251730
Learn OCaml. Semicolon delimits array elements, and can be used as an operator to chain multiple statements.
>>
>>59251751
Yes? And?
>>
>>59251758
I don't care about OCaml, it's not a useful language.
>>
>>59251777
trips confirm

dirty impure ocaml disgusting
>>
>>59251730
>Great, now how do you handle multiple assignments/updates in for-loops

We use for-loops with float values now?
Also, we can use dots if we did itwith the semicolon in the first example.
>>
https://theoutline.com/post/1166/programmers-are-confessing-their-coding-sins-to-protest-a-broken-job-interview-process

I genuinely think most programmers are retarded, and not in the LOL XD way.
>>
>>59251758
>Learn OCaml.
Why would I be learning a literal piece of trash?
>>
>>59251777
Whatever your opinion, its still obviously possible to let ; delimit expressions in an array.
Also, C (without GNU extensions) doesnt let you nest statements in an expression position like an array element, therefore the use of semicolon wouldn't clash and it'd be easy for the parser to still allow both uses
>>
>>59251777
According to?

>>59251801
>They also discriminate against people who are already underrepresented
The unqualified category seems well enough represented to me.
>>
>>59251777
Except for https://ocaml.org/learn/companies.html
(Not an Ocaml user myself)
Although many of those don't seem to be all that "useful" themselves. But this is a side-effect of any somewhat-affluent economy
>>
>>59251801
>some reddit link
>LOL XD
Back to your subreddit
>>
>>59251838
Did you even read my fucking post?
>>
>>59251838
you have to go back.
>>
>>59251801
I can understand not memorizing the precise details of an algorithm that you learned solely to know that you should never use it (bubble sort). But if you don't know a commonly used API in a language you say you have proficiency in, or you don't even know what "invert binary tree" means or are too much of a pussy to ask for clarification (since "invert" is a poor word choice there) then you deserve whatever you get.
>>
>>59251852
I did.
>>59251872
i'm already here. it's your turn now.
>>
>>59251798
>We use for-loops with float values now?
It's a perfectly valid use-case.

>Also, we can use dots if we did itwith the semicolon in the first example.
Great, more special snowflake syntax changes. Seriously, just use periods as decimal points. Ever heard the expression "When in Rome"?
>>
>>59251915
you have to go back, redditor
>>
>>59251920
>use-case
>>>/t/umblr
>>
>>59251833
According to people who realize that OCaml has nothing to offer. It's neither pure enough to be useful where correctness is paramount, nor performant enough to be useful where speed is paramount. It's like Java, in a way. A language for mediocre programmers.
>>
>>59251915
Can you understand sarcasm?
>>
>>59251937
Not an argument.
>>
>>59251939
i believe so.
>>
>>59251957
>Not an argument.
Not an argument.
>>>/r/ibbit
>>
File: stupid game.png (32KB, 866x1092px) Image search: [Google]
stupid game.png
32KB, 866x1092px
I programmed my first game! I'll be a game dev in no time!

The rules are kinda weird, I guess. I'm imitating this silly minigame that was designed to accidentally get you into debt. You don't actually pay your wager, but if you pull a card that matches your previous one, you'll need to pay the dealer the whole pot that you accrued.

Looks pretty shitty with card values instead of names, but I just wanted to see whether I could make something interactive with the meager amount of basic commands I've learned so far.
>>
>>59251958
Well, you seemed to miss it on my post.
>>
>>59251938
You posted these claims but can you back them up?
>>
>>59251981
>python
>that formatting style
Please fuck off back to plebbit.
>>
>your language is shit
>it's SHIT
>back to le plebbit
>Not an argument le ebin molyneux meme xD
>>/>r>/>idda>t/
Stay shit, /dpt/.
>>
>>59252003
My claims are self-backing. OCaml is garbage.
>>
>>59252004
you

have

to

go

back
>>
>>59252003
Sure.

The correctness claim is easy: it's impure.

The performance claim: http://benchmarksgame.alioth.debian.org/u64q/compare.php?lang=ocaml&lang2=gpp
>>
>>59251275
You're gay and know nothing
>>
>>59252032
I sense I touched a nerve.
>>
>>59252027
i can formally prove the correctness of any assembly program. pretty sure that's impure too. ocaml is trash though
>>
>>59252047
>i can formally prove the correctness of any assembly program
?
how?
>>
>>59252022
>le
>meme
>xD
spotted the plebbitor. you have to go back.
>>
>>59252047
>i can formally prove the correctness of any assembly program
Oh bravo. Now do it in a reasonable amount of time for any non-trivial program.
>>
>>59252060
mainly using type theory.
>>59252073
That's what I used to do back when I was working for the state.
>>
>>59251562
You can become a "useful programmer" if you like programming, age is not an impediment.

>But most of those things were reverse-engineered, i don't really know any of it
Continue programming things you like/want and then you will become more fluent at it.
>>
>>59252092
>That's what I used to do back when I was working for the state.
Haha, no.
>>
>>59252103
What exactly did you find funny here?
>>
>>59252047
Prove the correctness of an assembly program which checks if another program is going to halt or not for all programs.
>>
>>59252004
Fuck off, you disgusting kike.
>>
>>59252113
That you thought anyone would believe such a claim by someone on /dpt/.
>>
>>59252027
>it's impure
What prevents you from restricting yourself to a pure subset? Either way the industry shows OCaml has good uses, sorry the world doesn't conform with your view of how it should be.

>>59252023
ok
>>
>>59252124
>forgetting to mention "turing complete"
>>
>>59252124
that's my Phd thesis
>>
>>59252137
>What prevents you from restricting yourself to a pure subset?
Great idea, since that subset is a different language let's name it something else, I propose "A Worse Haskell".
>>
>>59252153
Pfff, in my school that was merely a freshman summer internship.
>>
Just had the best fap of my life, my cock and balls feel completely drained and they are almost aching.

anyone know a good book on LINQ?
>>
>>59252181
post the porn you fapped to
>>
D stands for Degenerate
>>
>>59252124
No.
>>59252132
Why do you think this claim is anything out of the ordinary?
>>
>>59252159
Debatable. OCaml isn't lazy.
>>
>>59252194
>Why do you think this claim is anything out of the ordinary?
Not the guy you're responding to, but remember where you are.

Most people on this board legitimately struggle implementing a functioning FizzBuzz.
>>
>>59252186
B L U E
O
A
R
D
>>
>>59252194
Because people who do (or did) that sort of thing for a job almost certainly don't spend their time posting on /dpt/.
>>
>>59252201
Hence "A Worse" Haskell.
>>
>>59252231
>laziness everywhere is good
>>
>>59252201
>OCaml isn't lazy.
so it's shit in other words?
>>
>>59252239
>pointlessly evaluating things is good
>>
>>59252239
Leave it to /g/ to buy into the buzzwords and feel enlightened.
>>
>>59252239
>i don't know what husklel is: the post
>>
>>59252239
{-# LANGUAGE Strict #-}
>>
>>59252213
Ooh! Ooh! Insult mine!

#include <stdio.h>
#include <stdbool.h>

typedef struct rule {
const unsigned factor;
const char *string;
} rule_t;

static const rule_t rules[] = {
{ 3, "Fizz" },
{ 5, "Buzz" },
};

int main(int argc, char **argv)
{
for (unsigned i = 1; i <= 100; ++i) {
bool matched_any_rule = false;

for (size_t r = 0; r < sizeof(rules) / sizeof(rules[0]); r++) {
if (i % rules[r].factor == 0) {
printf(rules[r].string);
matched_any_rule = true;
}
}

if (! matched_any_rule) {
printf("%u", i);
}

printf("\n");
}

return 0;
}
>>
>>59252217
Why would anyone ever think that? I'm genuinely interested in why you think that's the case.
>>
>>59252248
>>59252241
In a strict language you can get laziness with functions when you really need it. In Standard Haskell you cannot get strictness at all.

>>59252258
>implying Haskell's type system is impressive
>implying OCaml's module system isn't way better than Haskell's

>>59252274
Non-standard.
>>
compiling rustc is hell
>>
>>59252290
What do you need it for? And don't they have binaries?
>>
>>59252275
#include <stdio.h>

struct rule_t {
const unsigned factor;
const char *string;
};

static struct rule_t rules[] = {
{ 3, "Fizz" },
{ 5, "Buzz" },
};

int main()
{
for (unsigned i = 1; i <= 100; i++) {
int matched_any_rule = 0;

for (size_t r = 0; r < sizeof(rules) / sizeof(rules[0]); r++) {
if (i % rules[r].factor == 0) {
printf(rules[r].string);
matched_any_rule = 1;
}
}

if (!matched_any_rule) {
printf("%u", i);
}

puts("");
}

return 0;
}
>>
>>59252317
i'm compiling by hand.
>>
>>59252275
>printf(rules[r].string)
>not printf("%s", rules[r].string)
>not using range-based for loops over a sized array
>r++, not ++r
>not breaking out of loop early in if statement
>>
>>59252282
See most of the posts in this thread. Most posters haven't contributed a whit of evidence that they can program well. On the contrary, most of them bicker over inconsequential things and procrastinate, signs that they are not experienced or competent programmers.
>>
>>59252326
Yeah but I mean you still have to bootstrap it from rustc right? That's why I'm wondering if you do it because you did any change to the compiler.
>>
>>59252318
I get removing the typedef since it's never actually used, but why is using int instead of bool for a true/false variable better?

>>59252331
>>printf(rules[r].string)
>>not printf("%s", rules[r].string)
Longer and less clear.
>>not using range-based for loops over a sized array
This is C, not C++.
>>r++, not ++r
Does this actually make a difference? The result of the expression is never used.
>>not breaking out of loop early in if statement
You can't do that, you have to go through all of the rules.
>>
>>59252407
>I get removing the typedef since it's never actually used, but why is using int instead of bool for a true/false variable better?
cause my mom said its better
>>
How I feel after creating a perfectly composable, extendable, and general solution to a problem that perfectly tackles the essence of the problem using functional programming
>>
>>59252441
Bored as you wait for the GC to deal with 1GB of garbage being generated every second?
>>
File: stronger.jpg (65KB, 900x900px) Image search: [Google]
stronger.jpg
65KB, 900x900px
>>59252441
Forgot pic
>>
>>59252407
Actually storing bools on an int is incredibly inefficient from a memory pov since you'll use 32 bits for 1 bit of information. The best would be to use bitshifts instead. This might look slower but if you sort your data well enough it really isn't since you get many more cache hits.
>>
>>59252458
Actually in Haskell GC time is proportional to the amount of live data.
>>
>>59252407
printf's first parameter is a format string. Passing in something that is not a format string is a semantic error. This is a bad habit that can lead to something stupid like printf(someUserInput) in the future when it really matters.
>>
If your language doesn't have dependent types then it's not worth using.
>>
>>59252458
>i am angry
>angry about fp
>>
>>59252477
>tfw the only dependently typed systems language is ATS (autistic terrible syntax)
>>
>>59252477
don't even know what you talking about and don't really care. i use the language that gets me more dosh
>>
>>59252472
Oh shit, you're right.
>>
>>59252458
Actually in this case there's almost no garbage being generated.
>>
>>59252489
>i have no argument
>no argument to defend fp
>>
File: Haskell.jpg (29KB, 500x501px) Image search: [Google]
Haskell.jpg
29KB, 500x501px
>>59252530
The only garbage generated is the code.
>>
>>59252548
*tips fedora*
>>
>>59252552
8D
Mods please ban me so I can start doing productive things.
>>
>>59252548
I mean, you haven't seen it, and I feel pretty good about it. I never feel good about anything.
>>
>>59252284
There's only one de-facto standard, GHC. Nobody cares about the "de-jure" pseudo-standard (Haskell2010 or whatever they call it next)

So yes, in the real world it's is "standard".
>>
>>59252585
Post it then so we can stare in awe at your seemingly impossible accomplishment.
>>
>>59252585
show then.
>>
>>59252326
i didn't write this
>>59252317
>>59252348
gentoo
>>
>>59252595
>>59252598
Can't, it's for my job. Just wanted to share with someone and I don't want to confuse my coworkers before it's documented.
>>
>>59252535
>not an argument
>not an argument to shit fp
>>
Moved to a new computer and seem to be missing some lib or pkg on my fresh Linux install because something that built fine just a day ago on the prev OS now barfs this:

Linking ~/what/ever/path/to/Thang ...
/usr/bin/ld: cannot find -ltinfo
collect2: error: ld returned 1 exit status


What's
-ltinfo
? Googling it, it comes up for all sorts of build problems in all sorts of languages, but always as a side-note, impossible to figure out from those what's missing at *my* end.
>>
>>59252649
libtinfo is a terminfo library from ncurses
>>
>>59252649
It means you need the library provided by tinfo.
>>
>>59251070
I intentionally break referential transparency by writing anaphoric macros.
>>
Is there an offline version that does the same job as Visualise Python?
>>
>>59252700
Are you looking for a debugger?

https://docs.python.org/3/library/pdb.html
>>
Hey guys

So I was thinking of starting the Accelerated C++. I love the concept of the book, wish there were more books written this way in other subjects.

But the problem is that even years ago people were saying that Accelerated C++ was sort of outdated. And now the situation is certainly not better.

So how inefficient would it be to start learning from the Accelerated C++ and after that trying to update my knowledge, compared to starting with something like C++ Primer, or some other more up to date source?
>>
>>59252658
Thx but that's already installed and up-to-date according to `dnf install ncurses`. Back to Win 8.1 then? But dont-wanna dammit!
>>
>>59252809
>Hey guys
>that plebbit spacing
Return to your subreddit.
>>
File: 1470336249393.png (24KB, 256x256px) Image search: [Google]
1470336249393.png
24KB, 256x256px
Programming newbie here,literally began yesterday

i'm using codeacademy to begin and I've arealdy learned the basics of HTML,and to be honest it's not really hard,I'll just need to write down what each letter means.
how hard does it get?so far it's really fucking easy and I'm messing with margins and boders right now,and it feels very fine.
any tips or inspirational words for me?
>>
>>59252883
>it's unacceptable to get help from more than one site
>>
>>59252950
fuck you reddit
>>
>>59252950
html is pretty easy. Programming as whole can be VERY VERY tedious. Self learner here also, started with c#
>>
>>59252950
Don't know if this is bait to be honest
>>
File: are_you_fucking_serious (1).png (210KB, 456x355px) Image search: [Google]
are_you_fucking_serious (1).png
210KB, 456x355px
@59252950
>>
>>59252950
>>>/g/wdg/
>>
>>59252981
>>59252985
>>59253008
it's not bait,really,I literally just began and it's really fun
>>
In C++, is there a way to automatically correspond enum values with the strings of their given names?
Right now, I only know to laboriously fill out a function to return a string for each value of each enum class.
>>
>>59252950
>Programming newbie
>basics of HTML

hmmmmmmmmmm
>>
>>59253035
You should try C#.
>>
>>59253040
I began yesterday and I'm not fucking dumb,how hard could it be?
>>
File: vboxdbg.png (101KB, 981x1269px) Image search: [Google]
vboxdbg.png
101KB, 981x1269px
This has to be the shittiest debugger I've ever used.
And I'm using it to debug my own debugger.
>>
>>59253062
You need to be 18 to browse this website.
>>
>>59253062
HTML isn't really programming, it's just a markup language.

HTML is extremely simple. I guess it's nice if you want to get used to a particular text editor, but it's not worth putting a lot of effort into unless you are trying to go the web design route
>>
>>59253128
Enjoy your ban.
>>
File: monkey-puzzle.jpg (46KB, 617x416px) Image search: [Google]
monkey-puzzle.jpg
46KB, 617x416px
>>59252950
So, i'st monkey c++ anon here again.
Let's say you have an array of x size. Is there a fast way to find that x? In matlab it is length(x). Can I do something like that in C++? I thought it was sizeof but it is actually not.
>>
>>59253309
sizeof(array) / sizeof(T)
where T is the type of the array contents
>>
>>59253309
Use std::vector and use the size() method
>>
>>59253309
std::array has a size() method. If it's a regular array you need to do something like
sizeof a / sizeof a[0]
, or even better, keep track of it with a constant.

>>59253346
std::array
>>
>>59253338
Thank you, I'm definitely retarded.
>>
>>59253309
sizeof(array) / sizeof(array[0])
or
std::array.size()
>>
how long does it take for you to do an incremental build on your C/C++ projects? do you think an 8 core 16 thread amd ryzen cpu will be better than a 5 GHz i7-7700K for software development?
>>
Working on this 'Smart' mirror. Integrating a 3D camera with the hardware. I'm not sure how to 'base' the software around, since it is going to be running on an OK hardware and I will need it for basic AR stuff. I thought of building a full-sized linux application and auto-starting it on boot-up. This app would work like a homescreen and launch other apps. Could any linux guru please shed some light?

Primarily a VR developer and have worked on multiple enterprise applications using the Unreal Engine. If you have any questions, fire away
>>
>>59251273
You forgot
C is Cancer
C is Communism
C is Crime
C is Crap
C is for Cucks
>>
>>59253398
>communism
nowt wrong with 'at
>>
I cannot comprehend building a large system without OOP. How is it done?
Simple calculator? Sure. Physics engine? Ok. Xbox huge bank system to be used by tens of thousands of people per day with gross amounts of business logic and services? how the fuck?
How do you tie together state + behavior without objects? Is there a procedural equivalent of SOLID principles?
>>
File: dosbox.png (29KB, 656x439px) Image search: [Google]
dosbox.png
29KB, 656x439px
I'm playing with graphics in DOSBox, can someone help me figure out why Open Watcom rejects this code: http://pastebin.com/neLpRLaD ?
>>
>>59253604
Use enums istead of magic numbers.
Write tests.
Don't shit your code base with OOP.

Just few things to keep in mind when making huge code base.
>>
between C#,C and C++,which one is easier for a beginner?
>>
>>59253604
>How do you tie together state + behavior without objects?
Why do you need to do this?

>Is there a procedural equivalent of SOLID principles?
SOLID isn't really all that object-oriented if you change the word "class" to "type" or "function" or something. It's a pretty common sense set of rules.
>>
>>59253604
You modularize your shit, the term is wrong here but you turn components into "microservices" and have them work independently while using some sort of a backend that allows communication between them like a message queue.
>>
>>59253649
java and C# are the easiest imo but C is also easy and better to start with imo. then after C you can move on to C++ pretty easily. java followed by C++ is another path you can take. with C# you learn a lot of specific things that are only relevant to C# and the microsoft ecosystem so i don't recommend starting with it.
>>
>>59253649
Lisp.
>>
>>59253406
yeah, besides it being crime, crap, cancer and for cucks
>>
>>59253684
That sounds very object-oriented to me.
>>
>>59253687
nice reading comprehension retard
>>
>>59253616
>http://pastebin.com/neLpRLaD
use unsigned short int instead of uint16_t
or typedef it first
>>
File: 1488104300186.png (484KB, 712x480px) Image search: [Google]
1488104300186.png
484KB, 712x480px
>>59253649
C++
>>
>>59253649
Probably C#, followed by C, followed by C++. I would recommend challenging yourself and learning C first however. Learn to understand basic concepts without having to think of objects. Once you feel comfortable enough, you can move on to C# and start messing around with object-oriented programming.
C++ is disgusting.
>>
>>59253616
which version of C? maybe you need to declare all your variables at the start of the function
>>
File: 2017-03-05-21:16_1366x768.png (1MB, 1366x768px) Image search: [Google]
2017-03-05-21:16_1366x768.png
1MB, 1366x768px
>>59251070
GUI for a media organizer backend. Learning QML and Qt in the process. Right now trying to hook in the backend's tag autocompletion into the UI.
>>
>>59253735
>challenging yourself and learning C first however.
C is a beginner language.
>>
>>59253689
>crime
false
>>
>>59253763
communism is a crime against humanity
>>
>>59253708
I'm using uint16_t elsewhere without problems.

>>59253739
Oh shit, I forgot about that, I haven't used C89 in years. That fixed it. Thanks. Now to find out how to change the standard with this compiler.
>>
Why does my code segfault when I dereference a pointer in DS in an exception handler?
Same pointer works fine in normal code.
>>
>>59253395
pls help
>>
>>59253763
something which by definition requires large amounts of crime is itself a crime as far as i'm concerned.
>>
>>59253703
Exactly! That was what I was attempting to ask. How do you build large systems without object or object-like structures?
>OOP is disgusting. blah blah blah coupling and mutable state and blah blah. BOILERPLATE. Here let me show you how you can make this simple game in C++ without objects!
>>
How do I make myself more marketable? Been programming Java and Scala professionally for about 5 years
>>
>>59253762
Well yes. I didn't say it wasn't. My point was that it is more challenging than if he/she were to learn C# first.
>>
>>59253794
Shared mutable state is a major source of bugs in software
>>
>>59253807
Learn proper english.
Color yourself white.
Stop shitting on street.
>>
>>59253794
any large system will be more or less OOP-like. even with functional programming you'll end up using monads or some other things that have a very similar structure to OOP.
>>
>>59251562
Bit late to this reply, but yes. Becoming a decent programmer at 29 is more than possible.

Daniel Shiffman (google him) only started progamming in his late 20s.
>>
>>59253807
Ask Quora
>>
>>59253794
You just do. It's a lot more open than OOP. With OOP you can umbrella answer these ultra generic questions by saying "make an object" but that's just as meaningless when you think about it.
>>
>>59253827
>implying
>>
>>59253703
Well you sound very object-biased to me. Modules, record types, functions have been around well before OO, and with a rich-enough for polymorphism (not an OO concept) and typeclasses (called "interfaces" in OO but also not an OO concept) type system you have all the basic building blocks needed for scale.
>>
>>59253825
with proper OOP the mutable state is encapsulated and the objects are designed so that the state can't get messed up
>>
>>59253855
It's still

SHARED
MUTABLE
STATE

so it's still a problem, you've just made it harder to diagnose
>>
>>59253749
certainly shows some qt's
>>
File: 1449700279793.png (74KB, 300x256px) Image search: [Google]
1449700279793.png
74KB, 300x256px
>>59253829
>this whole post

>>59253851
I know, but your post was basically just talking about encapsulation and message passing, just without actually using the terms.

>>59253855
Shared mutable state not being able to be in an invalid state is only a partial solution. OOP does nothing about the problems it poses for concurrency and other reasoning.
>>
>>59253872
there will always be some amount of state in a program you fucking moron. and using OOP doesn't mean you can't have pure functions as well
>>
>>59253794
see
>>59253851
>>
>>59253888
>all state is shared mutable state
>>
>>59253888
>state
>shared mutable state
is it that fucking hard to understand the difference?
>>
>>59253885
>OOP does nothing about the problems it poses for concurrency and other reasoning.
neither does FP. concurrency is an unrelated problem.
>>
>>59253888
Yes, so you should do something like Haskell does and make it apparent in the type system.
>>
>>59253885
>I know, but your post was basically just talking about encapsulation and message passing, just without actually using the terms.
Eh I was another anon, not the original anon. That's what I get for not being a "name fag", dammit..
>>
>>59253914
FP encourages no shared mutable state because that's part of being pure.
>>
>>59253872
they keep parroting this "shared mutable state" bullshit, but won't elaborate further or give concrete examples of how this is supposedly a huge problem
>>
>>59253914
>FP is somehow the opposite of OOP
remove yourself from this thread, plebbitor.
>>
>>59253933
this
>>
>>59253829
Monads aren't "OOP-like" in the slightest, wtf. Let me guess, you started out with OOP and now everything-programming looks OOP to you
>>
>>59253933
Isn't it obvious?
>>
>>59253952
not an argument.
>>
is it possible to be for OOP and still not be clinically retarded? i honestly don't think it's possible at this point.
>>
>>59253933
Temporal coupling
Data races
Typically also means shared ownership, i.e. you need reference counting or GC or something (overhead) to manage the memory
>>
>>59253948
Monads are definitely objects, and Monad is a class.

Instances of Monad have members: the methods bind and return.

There are subclasses of Monad, such as MonadError and MonadState. Instances of them satisfy the Liskov substitution principle: you can use a (MonadError m e) where a (Monad m) is required.
>>
>>59253982
FP doesn't magically fix any of this
>>
>>59253855
"the objects are designed" so if the programmer is decent and can afford such discipline in the heat of the moment, on a deadline. Because it isn't enforced by the compiler, various optimizations, some related to concurrency/parallelism but also others, are not possible where shared mutable state is allowed without explicit annotations.
>>
>>59253933
>>59253945
You are either:
1) straight up moronic
2) a newfag who started programming this month
>>
>>59253933
>>59253982
Also it inhibits optimizations related to non aliased memory access
>>
>>59254000
*tips*

there's a reason OOP languages are by far the most successful and FP languages are irrelevant as shit
>>
>>59253998
see >>59253938
I would literally kill you right now if I could.
>>
The fuck niggers? Half of you are telling to learn c shit and others are telling that c is for fags and that one should learn java while some snowflake telling lisp is da best.
>>
>>59254000
He can also be both.
>>
my favorite is the inheritance strawman. as if any competant object-oriented programmer is going to rely heavily on inheritance
>>
>>59253980
OOP is very suited for modeling persistent stateful entities, like GUI components and such. It sucks for almost everything else.
>>
>>59253998
See >>59253930
>>
>>59254016
see >>59254021
>*tips*
yeah, i'm not surprised that an OOP fag would be from reddit.
>>59254028
>competant object-oriented programmer
Such a thing is impossible by definition.
>>
>>59254034
if you don't have persistent stateful entities you're not even a real program, you could just compute everything at compile time.
>>
>>59254028
Inheritance is the only exclusive feature of OOP. Everything else can easily be done, usually better, without OOP.

>>59254034
RMGUI is trash.
>>
>>59254022
yeah, it's almost like this isn't your home website (reddit) where people don't have differing opinions
>>
>>59253982
>data races
because synchronization and synchronization techniques are non-existent in OOP languages right?
>>
>>59254028
competent OOP programmers don't exist
>>
how do I think like a programmer? Thought I was doing well in uni but got a mid B on my written midterm and was a bit peeved at myself.
>>
>>59254022
everyone in this thread are retarded dunning-kruger shitkids. just learn whatever you want to learn, except you should definitely avoid python and haskell.
>>
>>59254062
In OOP languages "synchronization techniques" usually boil down to throwing mutexes everywhere which is so bad for performance that you might as well not even use multiple threads in the first place.

Sure you may be able to personally write code that doesn't use shared mutable state but at that point you might as well use a language with the type system and optimization to really get the most out of it.
>>
>>59253996
I code in Haskell, where a "typeclass" (the concept way predating "OOP" and the name coming from Haskell elder Phil Wadler) is a set of functions defined for a type. There are no objects in Haskell, and the "typeclasses" are a collection of functions umbrella'd under a name. If some party-like-it's-1999 Pajeet comes along and tells me that Monads and typeclasses are "objects, just like in OOP", I can tell them "objects are just records, like in Turbo Pascal ca. 1992, now buzz off because "OOP" adds nothing but headaches to intrinsically more powerful yet simpler concepts that existed well before and entirely suffice"
>>
>>59254048
You could have a few persistent stateful entities and everything else being written as a procedural pipeline.
>>
>>59254084
>muh performance
>he thinks hasklel has better performance than java
>>
>>59253772
>>59253791
>crime
>>
>>59254095
>muh
>>>/r/ibbit
>>
>>59254074
Every nigger asks ability to write scripts on pyton for my job.
>>
>>59254048
Again, retard, not all mutable state is shared mutable state.

>>59254095
Did I ever mention Haskell or Java?
>>
>>59253998
To be honest, one thing Rust learned from most FP languages is how it prevents Data Races, anon.
>>
>>59254095
dude fuck off with your FP hate, you are making me look bad
>>
>>59254095
Who are you quoting?
>>
>>59254104
>>59254121
>"synchronization techniques" usually boil down to throwing mutexes everywhere which is so bad for performance that you might as well not even use multiple threads in the first place.
it's clearly implying FP langs such as haskell are magically better at this than OOP langs like java. as if you don't need to synchronize (implicitly if not explicitly)
>>
>>59254137
Are you retarded? Serious question here.
>>
>>59254106
>one thing Rust learned from most FP languages
Actually the only language to do what Rust did with ownership and borrowing before it was Cyclone. Prior to that it was just theory (though it was Wadler that was instrumental in coming up with the ideas).
>>
>>59254147
kill yourself. i'd think you were trolling but you're probably this retarded for real
>>
>>59254137
see >>59254021
now fuck off back to your subreddit, retard.
>>
>>59254137
The only thing that ever, EVER, needs to be synchronized, in any way, is shared mutable state. Ergo, without shared mutable state, you need no synchronization and everything just works.
>>
>>59254172
yeah nice real-world software you got there kid
>>
File: 1458535072899.png (16KB, 669x557px) Image search: [Google]
1458535072899.png
16KB, 669x557px
>>59254184
Nice counter argument you got there Javafag.
>>
>>59254184
What sort of reddit posting style is this? Fuck off, I don't want any reddit stink nearby.
>>
>>59254137
>it's clearly implying FP langs such as haskell are magically better at this than OOP langs like java. as if you don't need to synchronize (implicitly if not explicitly)
Here ya go son:
https://www.fpcomplete.com/blog/2016/11/comparative-concurrency-with-haskell#why-haskell
"As you can see, Haskell offers many tools for advanced concurrency. At the most basic level, Chans and forkIO give you pretty similar behavior to what other languages provide. However, IORefs with compare-and-swap provide a cheap concurrency primitive not available in most other languages. And the combination of STM and the async package is a toolset that to my knowledge has no equal in other languages. The fact that side-effects are explicit in Haskell allows us to do many advanced feats that wouldn't be possible elsewhere."
>>
new anime thread when?
>>
>>59254150
True. Rust is like a kid heavily influenced by the internet.

>Learns mistakes from the other languages
>Improves itself with the features of other languages
>Turns into a complex Frankenstein that no one wants to deal with
>>
>>59254199
>hurr you don't need to synchronize if you don't have anything to synchronize
it's the same in OOP langs as well you shitty troll
>>
>>59254221
>Sure you may be able to personally write code that doesn't use shared mutable state but at that point you might as well use a language with the type system and optimization to really get the most out of it.
>>
>>59254208
other languages have compare-and-swap too, even java has it, fucking delusional cancer tard
>>
>>59254214
>Turns into a complex Frankenstein that no one wants to deal with
Rust is many things but it's sure as hell not complex, nor is it a Frankenstein.
>>
File: 1481833364101.gif (134KB, 340x340px) Image search: [Google]
1481833364101.gif
134KB, 340x340px
>>59254221
>OOP langs
>langs
>>
New thread: >>59254265
>>
>var needCoffee = true;
if (needCoffee) {
console.log('Finding coffee');
} else {
console.log('Keep on keeping on!');
}
why is it always shit shitty example?
I don't even like coffee
>>
>>59254243
>Neither functional nor OO
>Both functional and OO

It's like C++ and Erlang blended together. Plus the borrow check system.
>>
New thread:

>>59254292
>>59254292
>>59254292
>>
I was reading the Linux boot.s file and encountered the following instruction
movw
without any argument.
What does it do?
>>
New thread:

>>59254265
>>59254265
>>59254265
>>
>>59254270
>>59254330
Fuck off
>>
Anyone knows how D is right now? I searched but I only found some posts from *years ago* saying it still sucked. What about today?
>>
>>59254465
it's trash

just stick to based C++ at least until these hipster languages have proved themselves
>>
>>59254493
What should I use to start learning C++, then..? I've tried to start C but it was too much as a first "real" programming language (I've only got some experience w/ Lua and I do some C# without knowing what the fuck am doing (google-fu)
>>
>>59254597
D will literally never take off.
It might be a comfy language, maybe learn and use it in your free time.

If C was too hard for you then C++ is going to be a shitshow; that, or you'll learn terrible habits in it, incorrectly treat it like C# and not understand half of its semantics (see: most bad C++ programmers)
>>
>>59253053
It's gotta be C++
Thread posts: 335
Thread images: 18


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties.
Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.