[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: 352
Thread images: 37

File: SICP.png (294KB, 400x533px) Image search: [Google]
SICP.png
294KB, 400x533px
Old thread: >>61295410

What are you working on, /g/?
>>
>>61300449


>moslem
>programming
>>
File: monads.png (797KB, 793x670px) Image search: [Google]
monads.png
797KB, 793x670px
the monad as interpreted by functional programmers is the ultimate embedding of imperative programming within functional programming and represents the pinnacle of 20th century programming innovation, uniting imperative programming, type theory, category theory, first class functions, custom data types, procedural and imperative concepts along with continuations and the lambda calculus to perfect the concept of the pure typed programming language. it is the cherry on top of the proof within the pudding that functional programming is strictly superior to imperative programming.

philistine memesters need not reply
>>
main = putStrLn "Haskell!"
>>
Mudslims a shit, SHIT!
>>
>>61300423
You mean the guy who can't even traverse a binary tree?
http://www.yegor256.com/2017/02/21/say-no-to-google-recruiters.html
>>
Learning SFML
If I implement a battleships game with a server. I should only send coordinates to the clients, and not the whole game state right? I've never done any networking before.
>>
>>61300467
no
>>
File: file.png (109KB, 1121x759px) Image search: [Google]
file.png
109KB, 1121x759px
>>61300517
I'm starting to think that his writings are some sort of parody.
>>
Quick fact: You can put hijab on your head and expose most of your hair (according to Quran). Woman are not obligated to cover every gap on their head, contrary to the popular opinion that they have to wrap it around.
This was a measure taken back in time when Meccan men were likely try to rape/molest woman on the streets. Some fanatics took it too far and covered their wives in bedsheets.
>>
>>61300449
Learn Go:
https://tour.golang.org
https://www.golang-book.com
>>
>>61300449
Stop posting muslims in blue boards.
>>
>>61300579
I am learning it!

>>61300517
I don't get why people complain so much about the interviews. Is it a good gauge? Maybe. Does it only take like ~2 months to learn? Yes. Maybe 3 if you're on the spectrum.
>>
>>61300597
Stop posting hate speech on blue boards.
>>
>>61300608
But mudslims are truly cancer of this planet. No hate. Facts only.
>>
which is better, javascript or python?
>>
>>61300631
Which is better, cancer or AIDs?
>>
>>61300635
AIDs. Maybe not 30 years ago, but these days AIDs is okay.
>>
>>61300705
HIV is okay. AIDs is not.
>>
>>61300449
Fucking muslims
>>
File: 1442333266457.jpg (92KB, 358x350px) Image search: [Google]
1442333266457.jpg
92KB, 358x350px
>>61300567
>>61300517

I would have never thought so see someone so autistic about OOP

https://github.com/yegor256/eo/blob/master/README.md
>>
>>61300627
The only cancer in the world is *ews
>>
>>61300713
>example code
>what actually happens here? TBD
OOP must be wiped off the face of the Earth
>>
im writing a python bot that goes through github profiles, clones random repos, and google translates in-code comments to random languages and then makes pull requests
>>
>>61300743
Why
>>
Fuck that shit I'm learning C
>>
>>61300517
i'm not exactly an expert at programming. i only have a vague idea of what a binary tree is.
is there some resource anon could recommend that explains it well and how to do it?

i wonder exactly what question he was asked. seems like he brushes it off as them wanting an algorithm designer, instead of taking it as him lacking a skill anyone doing professional coding is expected to have.
>>
>>61300705
>these days AIDs is okay.
It's a very expensive and time-consuming hobby, much like JavaScript.

>>61300608
That's not fu- on second thought, it's hilarious.
>>
>>61300771
typical binary tree interview question is "what is the maximum element of an arbitrary binary tree?" or "please print every element of any binary tree."

should take about 15 lines, including the binary tree struct / class definition
>>
>>61300567

http://www.yegor256.com/2017/06/22/object-oriented-input-output-in-cactoos.html

I noticed how none of his commenters pointed out the fact that excessive memory allocation and deallocation is slow as balls, and that's exactly what he's doing.
>>
Trying to learn Java, not because I have a fondness for it but because I'll need it for a class in the upcoming semester.

I pirated the Java textbook my university uses and holy shit does this author love geometry problems.
>>
>>61300567

The madman...
>>
>>61300771
Binary trees are in basically every CS intro book. One book I really liked, which is basically SICP light, is concrete abstractions:

https://gustavus.edu/mcs/max/concrete-abstractions-pdfs/ConcreteAbstractions.pdf
>>
File: sal.png (22KB, 1063x249px) Image search: [Google]
sal.png
22KB, 1063x249px
why did anyone ever think SAL was a good idea?
>>
>>61300873

It's like the explicitness of Ada's passing modes but without any of the guarantees.

What's not to love?
>>
>>61300840
and they're not only slow but also make things more prone to crashing if for some reason the system fails to allocate memory(the easiest example being running out of memory).

then again, the higher level statements he's advocating against using could also be using allocation and you wouldn't know it because it'd depend on their implementation.
>>
I love OCaml and it's my favorite language syntax-wise, but the real big elephant in the room is not its JS-backend maturity. Rather it doesn't have kernel thread support...all threads are user-level just like Python due to a global lock for garbage collection. This means threads do not run concurrently across multiple cores. Intel is talking about having hundreds of cores on a single die by next decade and having programs that can't take advantage of that is extremely limiting. Xavier Leroy (the creator of OCaml) and his team at INRIA didn't think this was a big deal because when they were writing this stuff, processors were single core and had been since the beginning. Sure there were multiprocessor machines (not the same as multicore as there are multiple die), but those were only meant for servers/workstations. OCaml seemed very promising around 2006, the peak and end of the single core era with the Intel Pentium 4. What made OCaml so impressive was not only was it this beautifully simple, high-level functional language, but that the native compiler produced very fast code that was comparable to C/C++ performance. However, as multicore processors were introduced (Intel Core, Core 2), not having this capability made writing new code in OCaml less appealing. Microsoft was able to do it with F#, which is essentially a clone of Caml by targeting their .NET CLR. Haskell is able to do it with GHC. I still think OCaml is a wonderful language -- not having true multithreading doesn't make it useless. However, to me it has become more like a statically-typed Python which I can use for scripting. Having to use hacks like MPI to do multicore processing is a huge turn off in a multicore world. This is again nothing against the language, but the standard implementation needs a concurrent garbage collector and kernel threads. Otherwise I think OCaml may be doomed to irrelevance in the long run, which would be truly sad.
>>
>>61301109 (;;)
>>
Functional programming, despite having advantages, too often serves as a vessel for the aggrandizement of vapid establishment pablum.
>>
>>61300597
>>61300711
>>61300627
lel at all the triggered faggots. back to your safe zone please. Palestine will be freed and the Jews will be kicked out again, it is only a matter of time. History has proven it time and again and it is written on your books you fucking kikes. That is why you are soooooooo scared of kids throwing pebbles at your tanks.
>>>/oven/
>>
File: 2930129038129.png (4KB, 391x87px) Image search: [Google]
2930129038129.png
4KB, 391x87px
for fuck's sake
>>
>>61301212
Don't fall for the micromeme, anon.
>>
File: 1496814416957.png (835KB, 1024x626px) Image search: [Google]
1496814416957.png
835KB, 1024x626px
>>61300449
Alright can someone tell me what is the fastest way to get into Big Dataâ„¢? It is all the rage nowadays and I want to get a piece of it.
I already know R and a little bit of CPLEX. I have background in multi-variate statistics, mathematical modeling and optimization, and a little bit of machine learning models (logistic regression and such). I have a degree in management science/operations research.

My questions are the following:
1- Is it worth it to spend the time to learn about Big Data and the related frameworks (like Hadoop)?
2- What books do you recommend I read in order deepen my knowledge about the matter?
>>
File: hasbara_0178.jpg (189KB, 1024x611px) Image search: [Google]
hasbara_0178.jpg
189KB, 1024x611px
>>61301197
>unironically siding with sandniggers
Just kill yourself. 4chan has always been pro-Israel.
>>
>>61301259
>4chan has always been pro-Israel.
Fucking JIDF infesting every board
>>
Sandniggers and kikes both need to KTS
>>
>>61301249
If you studied OR you know enough to get a job in meme science / as an analyst. Hadoop can be nice however it's often more on the IT side of things

Here's my tip:

> analyze job ads in your region
> find out what they want
> learn this
>>
>>61301293
They mostly look for knowledge about SQL/SAP. SQL will be easy to learn thanks to the open source references. But what about SAP? that shit is closed source into oblivion.
>>
File: oreilly-whiteboard-interviews.jpg (123KB, 1024x1344px) Image search: [Google]
oreilly-whiteboard-interviews.jpg
123KB, 1024x1344px
>>61301249
>implying /g/ even knows what multivariate means
go to a site with a maturer population, you wont get help in this brainlet filled shithole

pic unrelated
>>
File: 1499058882412.jpg (297KB, 1280x870px) Image search: [Google]
1499058882412.jpg
297KB, 1280x870px
>>61301327
And you didn't help me with your comment either. Oh the irony.
>>
File: cute-jew.png (115KB, 800x729px) Image search: [Google]
cute-jew.png
115KB, 800x729px
>>61301361
>Being this entitled and demanding without giving back
I smell a Jew
I merely pointed out the fact that you would gain more information elsewhere.
>>
>>61294975
This is very bad advice.
The norm should be to always use signed. Because they're a less constrained case for the compiler they can optimize more. Especially now that ints are normally 32bit and computers are 64bit the gain is quite substantial. If you use unsigned the compiler is constrained to mod 2^32 behavior.
So signed ints should be the default you go to of you have something that won't wrap. Most compilers even do value range optimization that would let them use smaller types if appropriate. Though it's rare.
Naturally if we're talking struct members things are a bit more complicated but using ints there helps too compared to unsigned int. And VROs basically won't happen. Too complex for most compilers to figure out what the value range for a value is globally in the program.
>>
>>61301327
>>61301428
People like you are truly the worst posters.
>>
>>61300859
I can recommend Robert Sedgewick's book on intro programming with java. However, if you have some knowledge in java, primers or other overview books might be better.
>>
File: jew-radar.png (89KB, 406x406px) Image search: [Google]
jew-radar.png
89KB, 406x406px
>>61301464
jew confirmed
>>
>>61301314
Look if they ask for a certain dialect of SQL (T-SQL or PL/SQL are often used). They are an extension to the SQL standard. SQLzoo is decent for learning standard SQL

For SAP there are incredible expensive courses, some MOOCs which are free and you can get access to tons of books and a testing environment (learning hub) or just a live SAP installation (SAP live access). The most interesting modules for you are probably SAP HANA, BO and BW

If you are a student you can get all this for a reasonable price. If not the cheapest approach is live access which costs around $100-500 for 20 hours access + one course. The next cheapest alternative is learning hub which costs around $3000 for a year. Certified courses are around $8000 per course.

I learned SAP in school so I can't really say if they are that useful. In my experience SAP is a bit horrible but you can get the hang of it in a day or two if you are computer savvy.
>>
>>61301259
>>>/o/ven
GAS THE KIKE
>>
>>61301212
They have different semantic meanings but can be used in the same places.
I'd be more annoyed if they had 4 different structs where I needed to morph them into each other unnecessarily.
Elaborate on why this is so bad.
>>
>>61301474
I guarantee I'm more gentile than you, mutt. You sure act like one of the people you seem to dislike
>Oh no we can't have serious discussion on this site, not on my watch!
>I need to post memes while complain about the quality of discussion to gently guiding people away from this terrible terrible place!
I'm really surprised you haven't shilled for some other website that's ADL approved, "Hans". Juden raus.
>>
>>61301212
This is what hungarian notation is for.
>>
File: fragzeichen2.png (174KB, 562x389px) Image search: [Google]
fragzeichen2.png
174KB, 562x389px
>>61300449
Is there *any* reason for not making use of static typing? It seems to solve so many problems for programs and programmers alike.

Literally the only criticism of it is "I'm a brainlet and don't want to spend half an hour acquainting myself with type systems"
>>
>>61301259
>motivating your land ownership using the Bible
You do realize the world would be owned by a single religion if this were the case?
Also natives have no sway over land ownership in the modern age. It's all political.

This is a thread about programming though. So keep it OT.
>>
>>61301548
It depends on whether the language has a shitty type system.
>>
>>61301558
Well yeah. What I'm saying is that all languages moving forward should have static typing. No C shit.
>>
>>61301548
It's an attitude that comes from C-like languages that require you to declare types everywhere. It has nothing to do with static typing obviously. But brainlets do interpret it that way.

I find regardless that declaring types is much better. You can make your editor fix most of the redundant typing if you're not lazy/too lazy.
>>
>>61301576
strong typing*
>>
>>61301581
Needing to declare types is largely redundant anyway. You can infer them in most cases.
>>
>>61301594
Indeed. I'm think that primitive types of the language should get inferred and custom types should only get inferred if you name the values in initialization.
Because otherwise you run into ambiguities all over once you add a type. Which is horrible. Future code shouldn't break programs like that.
>>
>>61301489
This advice is very valuable. Screen capped for future reference. Thank you based anon.
>>
File: 1496762612266.jpg (31KB, 449x546px) Image search: [Google]
1496762612266.jpg
31KB, 449x546px
>>61301428
>You can gain more information elsewhere
>Did not provide a single reference/link
Is this the new level of troleing?
>>
>>61300579
http://nogenerics.info/
>>
>>61301249
>1- Is it worth it to spend the time to learn about Big Data and the related frameworks (like Hadoop)?
No
>>
>>61300449
Mods please,ban this muslim-posting tramp.
>>
>>61300449
kill yourself
>>
>>61301879
Why?
>>
JIDF is raiding /g/
>>
>>61301865
Good answer and I will be very thankful if you can elaborate on why Hadoop is a useless meme.
>>
>>61301197
IBN HALAL
B
N

H
A
L
A
L
>>
>>61301841
Why would you require links?
>>
I want to kill myself. What do 90% of libraries have the shittiest documentation ever?
>>
Friendly reminder that you can report OT posts if such should appear.
>>61302027
Because it's boring to write. Tools like doxygen are great because they make it easy. But they don't help you with example code for instance.
>>
I mostly program in languages discussed here but was researching some js-based web development recently and found
>The style attribute accepts a JavaScript object with camelCased properties rather than a CSS string.
in the React reference. So variable functionality is determined by whether they're camelCased? And it seems classes don't count as classes unless their name's first letter is capitalized. Here I was thinking just checking for a single certain character at the beginning or end was an efficient way to do such discrimination.
So this is Webdev, huh...
>>
File: anko_dither.png (9KB, 477x719px) Image search: [Google]
anko_dither.png
9KB, 477x719px
I think I am getting the hang of this dither matrix shit.
>>
File: CEZRSlXXIAANO6c.png (67KB, 600x549px) Image search: [Google]
CEZRSlXXIAANO6c.png
67KB, 600x549px
Senior full-stack, agile JavaScript developer
120k + equity
>>
/prog/ I have a legit question for you
Are we ever going to get legit Ais like Net navis and PETs?

Or is it that complex still? There's some "team" working on an android app for it that's not capcom and they said that they have made a bit of headway with it showing it off on facebook and they have a discord. Just some 3D modeling and what not
>>
I'm doing exercise 1-9 of K&R and my code doesn't work. Instead of printing out user input while deleting unnecessary whitespace, it prints out user input while deleting unnecessary whitespace AND the first letter of each word.
Could I get some help?
#include <stdio.h>
int main()
{
int c;
while ((c = getchar()) != EOF)
{
if (c != ' ')
{
putchar(c);
}
if (c == ' ')
{
putchar(c);
while (c == ' ')
{
c = getchar();
}
}
}
}

>>
>>61302587
You will never have a real general AI like that unless we discover a new branch of AI or find some new way of combining different AI branches
>>
>>61302632
The last iteration of your inner loop calls
c = getchar()
but the value is overwritten by the outer loop's
c = getchar()
>>
>>61302671
Sorry but I don't really understand why that changes the output to remove the first non-whitespace character of every word.
The else instruction hasn't been introduced in the book yet so I've also assumed that I can make this work without using it.
>>
I want to practice multithreading. What are some simple programs I can develop that make proper use of multiple threads. Ideally I would like to be able to encounter problems such as race conditions and deadlocking.
>>
>>61302670
So even without that, think netbattling might ever be a thing?
>>
>>61302681
Step through your program with a debugger and it will get clearer

When it reads the last whitespace, getchar() is called twice, thus swallowing the first character of each word
>>
>>61302700
Yeah, I'll use a debugger. But I think I understand now. Thanks a bunch anon.
>>
>>61302688
Wouldn't that just be a game then?
>>
>>61302632#include <stdio.h>
int main()
{
int c;
while ((c = getchar()) != EOF)
{
if (c != ' ')
{
putchar(c);
}
}
}

You want to not print ' ' if I understand correctly, right? What are you trying to do in the if (c == ' ')?
>>
>>61302720
The program should take an inputted string and print out the same string but by removing consecutive whitespaces, so
"The    quick    brown    fox"

should become
"The quick brown fox"

It shouldn't delete all whitespace. I'll try to find the solution myself now that I know where the problem is though.
>>
>>61302717
Yeah but I wanna use like physical chips to insert and what not
I guess something similar to how Megaman starforce worked for that one.
>>
>>61302728
Oh I see. I can give you a solution if you want, or a hint, or try to solve it yourself.
>>
>>61302779
Thanks but I'll try doing it alone for now.
>>
>>61302687
Classic problem:

> The problem describes two processes, the producer and the consumer, who share a common, fixed-size buffer used as a queue. The producer's job is to generate data, put it into the buffer, and start again. At the same time, the consumer is consuming the data (i.e., removing it from the buffer), one piece at a time. The problem is to make sure that the producer won't try to add data into the buffer if it's full and that the consumer won't try to remove data from an empty buffer.
>>
File: 1495831699850.jpg (185KB, 800x850px) Image search: [Google]
1495831699850.jpg
185KB, 800x850px
>>61300449
Are you purposefully trying to kill /dpt/?
>>
>>61302632
Insert putchar(c) after the while(c==' ') loop.
When you exit that loop you've got a non space character stored in c. But then the outer loop will overwrite the character. So that's why the first character after a space will not be printed.
>>
>>61302971
>Insert putchar(c) after the while(c==' ') loop.
With an if to check if c is eof, so he doesn't have an extra space at the end if it ends with space.
>>
>>61302966
Just like the rest of Europe.
>>
I need to learn C++ in 27 days, how should I go about doing it?
The most complex programming I've done has been RTOS and 2nd year algorithms so I'm not really familiar with real programming.
>>
>>61303035
You know C?
>>
>61303035
Then implement some algorithms and try to use features of c++ you are not familiar with.
>>
>>61303014
Yeah perhaps.
I didn't bring it up because frankly I feel exercises like these are a complete waste of time. But if anon is happy doing this it's great obv.
>>61303024
What
>>
>all of this 30 line C code that could be done in one line in python
lmao
>>
>>61303047
Not in terms of programming but I can implement algorithms and use pointers/simple memory management.
>>
>>61303066
But take 300 times longer to execute
>>
>>61303082
Good.

Why do you need to learn C++? Do you know general OOP principles?
>>
>>61300536
>I should only send coordinates to the clients
Ideally you only send what should be known by the client with eventually some sort of checksum of the current game state to make sure it's still synced. If it's not, send the state.
>>
do getters and muh encapsulation have a meaning for fields which are final? i'd rather use a public final field than a getter for a final field
>>
>>61303110
It's apparently a prerequisite for one of the classes I'm taking next semester but we've only been taught C so far.
And I do know general OOP principles although that's not to say I write good code.
>>
File: artistic-merchant.gif (2MB, 250x250px) Image search: [Google]
artistic-merchant.gif
2MB, 250x250px
>>61301536
Im back.
Look goy. Your too retarded to google data science resources and want to work in this field? It is more than just learning tools you know? Im starting to think you are more of a Pajeet now.
>>
>>61303123
its "final" idiot. Why you think they named it final?
>>
>>61303128
What's the class? I'm just trying to figure out what aspects you should focus on.
>>
>>61303123
It depends I guess. If it's a constant that is mostly relevant to the class then a getter wouldn't be a bad idea. If it is relevant to others as well make it public who cares.
>>
>>61303152
>reading comprehension
im asking which is better between

class Foo {
private final int a;
private final int b;

public Foo(final int a, final int b){
this.a=a;
this.b=b;
}

public int getA(){
return this.a;
}


public int getB(){
return this.b;
}
}


and

class Foo {
public final int a;
public final int b;

public Foo(final int a, final int b){
this.a=a;
this.b=b;
}
}



>>61303159
i use these classes for messaging between classes
>>
File: cannon.png (20KB, 640x353px) Image search: [Google]
cannon.png
20KB, 640x353px
How can I check if the ball I shot will enter at the left or at the right of the ball at the trail?

Do I just subtract the x coordinate of the ball I shot from the x coordinate from the ball on the trail?

Something like ball_on_trail.x - ball_shot.x. If the result is positive, balls goes to the right; else, left. Am I thinking right?
>>
>>61303200
The latter.
>>
>>61303139
على زبي
>>
>>61303207
>If the result is positive, ball goes to the right
Fix'd.
>>
>>61303200
getters then imo
>>
>>61303226
actually nevermind, second may be better
>>
>start to get into C after exclusively writing C# for years
>rewriting all my programs without problems within 2 weeks
>programs all use 10x less memory and run 10x faster than their C# equivalents
wtf i love C now??
All this time I'd heard nothing but shit about how hard C is and so on, I can't believe I bought into that meme. C is one of the simplest languages I've ever tried. I'm sure it's more difficult to manage all your resources in multiple 100k LOC projects, but for most things I see no reason why I shouldn't use C. Sure it's crude and doesn't have a lot of the nice features of other languages, but it's generally simple enough to write your own implementation which is even faster.
>>
>>61303217
>>61303226
>>61303242
thanks lads
>>
Hey /g/oys. I used to write in Python but I'd realised its inefficiencies and want to switch. What's a nice compiled language that doesn't rely too heavily on OOP, has strong typing but not too much structuring and can be used to write, for example, an image viewer? Much obliged
>>
>>61303259
Thanks for the blogposts.
>>
>>61303293
sorry i'll go back to shitposting about politics
>>
>>61303259
Only fools say C is a complex language. C is simple, which means any complexity lands in the code.
>>
>>61303094
Maybe it's time to upgrade your Pentium 4.
>>
>>61303094
not really
>>
python is...
smaller than c
almost as fast as c
more portable than c
>>
>>61303338
>almost as fast as c
lmao
>>
>>61303338
>smaller than c
>almost as fast as c
>more portable than c
These are all objectively wrong.
>>
>>61303207
Should work if the cannon is aligned with the ball at the trail. If you have a moving cannon just predict the path
>>
>>61303338
>smaller than c
incorrect
>>
>>61303338
python is...
c + bloat and hipster memes
>>
I started using Rust and I'm liking it.
What should I do to purge myself of these feelings?
>>
C is stupidly redundant.
>no type inference
>have to typedef structs
>have add your own namespace to each function because you can't just declare some kind of prefix block
Fuck C is stupidly arcane, too bad it's the only language you can easily export C API without jumping through retarded loops like extern "C".
>>
RUST IS THE MASTER RACE
THERE'S A REASON IT'S THE MOST LOVED LANGUAGE FOR THE SECOND YEAR IN A ROW
https://insights.stackoverflow.com/survey/2017#most-loved-dreaded-and-wanted
>>
>>61303399
>rust most loved
paying for shills and websites to rig charts seems to be effective.
>>
>>61303380
>>no type inference
Meh. C's type system isn't so disgusting (see C++, Rust) that it requires it to be hidden behind type inference.
>>have to typedef structs
No you don't. Stop typedefing shit without a good reason to.
>>have add your own namespace to each function because you can't just declare some kind of prefix block
That just sounds unnecessary, and seems like it would still lead to conflicts.
#include <stdio.h>
namespace shit_ {
int printf(const char *fmt, ...) {
// ...
}

void fn() {
printf("Hello world!\n"); // Which one is called?
}
}
>>
>>61303399
>no HKTs
>no rank-n-types
>>
>>61303380
>no type inference
Makes it easier to write a compiler.
>have to typedef structs
You don't need to, and it actually makes your interfaces clearer if you don't.
>have add your own namespace to each function because you can't just declare some kind of prefix block
Honestly its only flaw, but the people using it are adults, so they can manage it.
>>
>>61303380
>without jumping through retarded loops like extern "C".
You say that as if extern "C" is somehow hard or complicated, or something.
>>
>>61303454
He's autistic and just needs a reason not to use sepples.
>>
>>61303454
because you can't include anything but very small subset there which means you have to write wrappers for everything and at that point it's just easier to write plain C.
>>
>>61303467
C++ provides enough reasons on its own.
>>
>>61303433
No language is flawless.
>>
>>61303496
Those are pretty big flaws
>>
>>61303473
That very small subset is exactly what you were asking for for the last few weeks.
>>
>>61300743
You're doing gods work.
>>
>>61303509
>implying this is not my first day on 4chan
>>
>>61303133
How stupid do you even have to be to assume everyone on here is the same person? Fuck outta here.
>>
>>61303281
fuck off we dont help noobs here moron
>>
>>61303505
They're not though...
>>
>>61303259
C is so simple, that it takes a genius to understand it's simplicity.
>>
>>61303595
No lenses or similar optics, for a start.
>>
>>61303281
C
>>
>>61302311
>full-stack
>javascript
does this refer to the browser as being "the full stack"? Is layer 1 HTTP?
>>
>>61303633
It means clientside and serverside.
>>
>>61303642
I imagine "server-side" for a javascript developer means "I install docker containers".
>>
>>61303656
It's node.js typically.
>>
>>61303656
It means node
>>
>>61303656
Typically isomorphic JavaScript with Meteor, React or similar frameworks running on NodeJS
>>
>>61303663
>>61303678
>>61303685
I insist javascript developers stop calling themselves "full stack" because they install node.js based on a tutorial they found on digital ocean.

Thank you.
>>
>>61302632
>>61302728
can you use regex?
check for \s+ and replace with " " or something
>>
>>61303625
You're literally making up programming terms now.
>>
>>61303723

lens :: (s -> a) -> (s -> b -> t) -> forall f. Functor f => (a -> f b) -> (s -> f t)
>>
>>61303713
You're a fucking idiot with no grasp of the real world. When was the last time you left your house?
>>
>>61303731
this function itself doesn't use rank n (it does use hkts), but the type synonym Lens does
>>
>>61303713
https://en.wikipedia.org/wiki/Dunning–Kruger_effect
This is you.
>>
>>61303733
>>61303743
what's wrong with anything I said? It reminds me of the programmers the local college churns out who are 100% lost the second they leave their IDE of choice.

The idea that these people are "full-stack" is hilarious.

You guys realize this is /dpt/, not Dreamweaver general, right?
>>
File: 300013_900.jpg (40KB, 400x504px) Image search: [Google]
300013_900.jpg
40KB, 400x504px
Redpill me on was my lads

Some people seem to be butthurt about "closed web", inability to read sources, but isn't wasm a gud thing overall?
>>
>>61303731
what the fuck is this
>>
>>61303751
minified and obfuscated js is already unreadable
>>
>>61303748
What do you imagine "full-stack" means

>>61303751
We already have "closed source" JS (processed with obfuscator), WASM might just make them a bit more efficient. The people who want their WASM projects to be free/libre will still do that, the people who want their code to be proprietary will still do that.
>>
File: 1480265510400.jpg (21KB, 218x265px) Image search: [Google]
1480265510400.jpg
21KB, 218x265px
>>61303765
>javascript "programmers" believe this
>>
>>61303751
wasm isn't closed. i dont know where you got that idea. you can still read the source in your browser.
>>
>>61303743
https://danluu.com/dunning-kruger/
>>
>>61303778
in the same sense you can read assembly
>>
File: 1482078062070.png (84KB, 1207x453px) Image search: [Google]
1482078062070.png
84KB, 1207x453px
>>61303773
the whole stack, not only part of the top layer.
>>
>>61303776
obnoxious dumbasses don't
>>
>>61303788
You can if your IQ is above 100. What's your point?
>>
>>61303786
>https://danluu.com/dunning-kruger/
type systems fags B T F O lmao
>>
>>61303755
type Lens s t a b = forall f. Functor f => (a -> f b) -> (s -> f t)
lens :: (s -> a) -> (s -> b -> t) -> Lens s t a b


consider the specialisation

type Lens' s a = Lens s s a a
lens' :: (s -> a) -> (s -> a -> s) -> Lens' s a


so given an
(s -> a)
and an
(s -> a -> s)
we can build a (Lens s a)

now what do you think a lens is?
>>
>>61303432
>C's type system isn't so disgusting
kek okay enjoy your "void doesn't mean nothing, just doesn't mean anything " type system

your namespace thing is retarded though. in C there are conflicts in that case by definition. with namespaces, you can prevent the conflict. that actually might be one of the dumbest examples I've ever seen though. it's like saying "I can write a generic function in Java that crashes if the argument isn't instanceof String. therefore generics are worthless"
>>
>>61303788
Nigga I've coded in assembly, I've cracked games. The idea that "minified and obfuscated javascript" is... anything, is hilarious.

Where did all these JS fags come in? this isn't /wdg/
>>
>>61303816
what the fuck is this syntax
nigger stop making shit up
>>
>>61303835
>how do you write this in rust?
you can't
>>
>>61303833
I am not talking about obfuscated js you doofus
I am talking about WASM
>>
I have the most retarded problem ever (ASP.NET MVC 5 C#)
In the AccountController I register a new user and redirect

return RedirectToAction("Index", "Manage", new { id = user.Id, msg = "newUser" });


this redirects to my ManageController's Index, which expects an id and msg.
public ActionResult Index(string id, string msg)


AND THEN THE FUCKING MSG STRING TAKES THE VALUE OF THE ID, SO NOW I HAVE TWO STRINGS WITH THE SAME VALUE

WHAT THE ACTUAL FUCK? someone please give me some advice
>>
File: j2v0UI7.jpg (498KB, 1280x1698px) Image search: [Google]
j2v0UI7.jpg
498KB, 1280x1698px
>Nigga I've coded in assembly, I've cracked games. The idea that "minified and obfuscated javascript" is... anything, is hilarious.
>Where did all these JS fags come in? this isn't /wdg/
>>
>>61303842
Sorry, got lost in the reply chain.
>>
File: 6c3.jpg (1MB, 2096x2440px) Image search: [Google]
6c3.jpg
1MB, 2096x2440px
>Nigga I've coded in assembly, I've cracked games.
>>
>>61303829
Void is exactly what the name implies, it's the absence of type information.
Namespaces are just implemented through symbol name mangling, there's nothing wrong with writing your own goddamn names. If you want to, you can even use #define to define shorter names in your own code (sounds confusing Imo but I had a teacher who did that)
>>
File: trench-coat-ew.jpg (28KB, 600x575px) Image search: [Google]
trench-coat-ew.jpg
28KB, 600x575px
>The idea that "minified and obfuscated javascript" is... anything, is hilarious.
>>
>>61303833
Hahaha I wish they guy from /vg/dfg who edits edgy quotes onto pictures of 50 cent was here.
>>
>>61303866
>>61303887
>>61303893
/wdg/ is calling
>>
>>61303123
>>61303200

second one are still sonarqube errors, if you're a wagecuck
also this will fuck you up, but its obviously situational:
public class FooSubclass extends Foo {
int x;
FooSubclass(int x) {
super(x);
}
}


and run this main
    public static void main(String[] args) {
Foo f1 = new FooSubclass(1);
FooSubclass f2 = new FooSubclass(2);
System.out.println(f1.x); //1
System.out.println(f2.x); //0
}
>>
>>61303893
>using #define for anything
How unsanitary
>>
>>61303866
That's disgusting.

>t. muscular pussy slayer who writes in JS

It's ok, stay mad, fatass.
>>
>>61303907
>C needs namespaces and a more """"advanced"""" type system
>you... you're just a WEBDEV!!11!

>>61303927
It's definitely gross, there's no getting around that.
>>
File: 1479527048099.jpg (85KB, 600x857px) Image search: [Google]
1479527048099.jpg
85KB, 600x857px
>>61303943
Yes, this the thread where we argue about OOP and why C++ is actually cancer or whatever.

Please take your pleb /wdg/-tier posting back to /wdg/.
>>
>>61303966
>wants namespaces in C
>wants an overdesigned type system in C
>not a /wdg/-tier brainlet
honestly your shitposting is less shitty than the mooslam pictures so I can't even be mad.
>>
>>61303973
I'm sorry, I understand you're a /wdg/-pleb, but I think you're confusing me with someone else.
>>
>>61300449
>Dem hazel eyes
>Glasses
Is this a mooslum Yuki? Not sure if I approve
>>
I made $80k this year using nothing but Python and Bash.
>>
>>61303983
Read your own damn replies, you replied to my post regarding the use of void and namespace's in C
>>
>>61304005
No, I didn't. Do you understand how an anonymous image board works? Clearly you don't, maybe you should go back to /wdg/ and ask the other webdevs for help.
>>
>>61300462
>muh "moan ads"
>muh "lamb duhs"
>muh "philly steens"
>muh."meme stairs"
>>
File: 1499296153008.gif (2MB, 450x258px) Image search: [Google]
1499296153008.gif
2MB, 450x258px
>>61304015
Don't ever fucking reply to me again or I'll fucking rip your head off and shit down your neck.
>>
>>61303893
void is a type, and values exist in a type. therefore the "void type" implies the absence of a value (which it is, for return values of functions). just like how "int type" implies the presence of an integer value (not an integer type)
namespacing involves mangling but unless you're doing something where name mangling matters there's no argument against it. why would you give up the ability to use the same identifier twice? is writing shit like
fopen and malloc and glBegin really any better?
>>
Reminder that "computers" are an object oriented imperative mutative nonfree bloated slow poo in the loo LIE!!!! Built on the pure functional stateless truth of more general circuit design. Electrical components are the perfect physical implementation of lambdas. Unfortunately they aren't first class -- you can't send a component as an electrical signal between other components -- but you can compose them, map them, curry them, fold them, and so on. Processors are a LIE! You do NOT need a CPU, or even an ALU, to do extremely efficient high level functional programming that runs MUCH faster than what passes for a """""computer.""""" Just grab some copper wires and a soldering iron, "write" your program, and hook it up to a battery.
>inb4 combinatorial logic is lower tier than Turing """"machines""""
Indeed, but stateless circuit design is not restricted to combinatorial logic.
>inb4 fpga shill
I'm not talking about FPGAs, I'm talking about circuits that do not interface with or resemble a """"""computer""""""" processor in any way. And yes, the "do not interface with" is equally important. I/O is evil, after all.
>>
What the fuck did you just fucking say about me, you little bitch? I’ll have you know I graduated top of my class in the asemmbly course, and I’ve been involved in numerous of secret ddos raids, and I have over 300 confirmed games cracked...
>>
>ffmpeg version N-86723-g3b3501f Copyright (c) 2000-2017 the FFmpeg developers
>built with gcc 7.1.0 (GCC)


damn
>>
>>61304101
*clocks your path*
>>
File: 1498525177149.png (209KB, 632x175px) Image search: [Google]
1498525177149.png
209KB, 632x175px
>>61304055
>values exist in a type
except for void
>is writing shit like fopen and malloc and glBegin really any better
I completely understand this sentiment, however I do enjoy that when I see "fopen" or "glBegin" I know exactly what that function refers to. I don't have to look at the broader context of the program, I know that fopen is opening a file, and glBegin is drawing to a GL context (I'm pretty sure). Namespaces are good when you're writing large, monolithic programs. Avoiding namespace collision encourages (hopefully) C programmers to write small, flat programs, that can be combined piecemeal through IPC (like pipes, shared memory, signals, w/e). I realize this is a Unix prejudice, as process spawning and IPC on Windows is both more expensive and more verbose, but I think it works well for Unix and for C.

>>61304123
>gcc 4 came out 10 years ago
>>
>>61304154
void is a type which expresses exactly one value.
>>
>>61304193
What value is that?
>>
>>61304207
void.
>>
>>61300517
This is probably why /dpt/ is mad about C++: because they want to hate OOP so badly, and people like this guy make it so easy, but C++ on the other hand just crushes that dream. If you take OOP in all its lengthy butt-ugly glory and add intuitive operator overload methods, type inference, range-based for, and temporaries, then code using classes and methods becomes as brief, readable, and easy to write as code using functions.
>inb4 bitching about template and namespace syntax
obsolete, use auto, wherever you can't use auto just use decltype, if decltype is too ugly then just #define typeof decltype and use typeof
>>
>>61304207
the absence of type value
>>
>>61304101
>circuitry
>purely functional
k tard
>>
>>61304240
>dude just like use "auto" bro!
>>
>>61304149
*teleprots behind u* noting personnel kid *tips katana* *unsheathes fedora*
>>
>>61304259
Yes.
Exactly.
Just use "auto."
The intent of your mocking tone is unclear, since this is genuinely a good idea and you've provided no suggestion to the contrary.
>>
I was looking through the gcc source code and found this in c-parser.c.

vec<tree> incomplete_record_decls;


It looks like a cpp template but C doesn't have templates so I have no Idea of whats
going on. Does anyone have any ideas?
>>
>>61304283
https://github.com/gcc-mirror/gcc/blob/master/gcc/vec.h
>>
>>61304283
just because the file ends with .c doesn't mean sepplesfags wouldn't try to compile it with g++.
>>
>>61304252
It's true. A component is a lambda, a whole circuit is just a recursive function built by circularly composing lambdas
>>
>>61304154
>except for void
yes, because it's an empty type. therefore, it is not the absence of type information but the absence of values. however, C is inconsistent in its treatment of void and sometimes applies both definitions
as for fopen/malloc/glBegin, I see what you're saying with keeping things simple, which is true in the way C++ programmers are told to avoid using namespace <x>, but I also disagree with that personally. I see why being explicit about modules can help, but it's also really time consuming. I'd much rather a declaration like:
"In this file, open = fopen, begin = glBegin, etc."
so you can use modules explicitly || rename functions from external modules
>>
File: 5149894882554.png (295KB, 533x533px) Image search: [Google]
5149894882554.png
295KB, 533x533px
>>61304240
>OOP is using classes
>>
>>61304326
>therefore, it is not the absence of type information but the absence of values.
Actually void is an incomplete type so it is indeed the absence of type information
The reason you can still use it for some things is that it's not the absence of type, just the absence of type information
>>
>>61304346
You're thinking of void*, not void.
>>
File: stoned-guy.jpg (24KB, 555x555px) Image search: [Google]
stoned-guy.jpg
24KB, 555x555px
>>61304336
>using classes isn't OOP
>>
>>61304356
What you said isn't a contradiction to what >>61304336 said.
>>
>>61304326
>sometimes applies both definitions
I've honestly never given void much thought, or the type system for that matter. In what way does C apply both definitions? Are you referring to void*? In that case void is still the absence of type information.
I think the question of namespaces is really one of personal taste. I see C++ namespaces as being a bit of a clusterfuck (although one of the least fucky elements of the language). I think namespaces encourage a heirarchial program structure, that leads to a lot of internal complexity. A "flat" namespace system like in python (well flat-ish) or go could be quite workable, but I'd want some kind of enforcement like one namespace per file or something. You could do something with library structure, where for each library, a new namespace is created, but I think that could get ugly fast. Locally aliasing functions sounds harmless, and there's not really anything stopping you from doing this, except for the long type signatures on function pointers.
>>
>>61304354
No, void* is a complete type and does sport type information
Namely its size is that of any data pointer, and instances of it can exist and be compared
>>
>>61304356
But it actually isn't, anon. Just because you use classes, doesn't mean your code is object-oriented. You can make 100% procedural code using classes.
>>
>>61304364
Yeah, but he's suggesting I was saying what he's greentexting, but I wasn't. The inverse of what I was greentexting was a premise of what I was saying, but that's okay, because it's true. Using classes is OOP. Using classes is not all that OOP is -- i.e. OOP is not using classes -- but I never suggested it was.
>>
>>61304310
yeah dude, new circuitry for registers are spawned on every ticks. we all know that, amiright? no seriously, how retarded are you?
>>
>>61304376
Code that uses classes probably calls methods. Code that calls methods treats the methods as properties of their receiver. Code that treats functions as properties of objects whose fields they use is OOP.
>>
>>61304422
>using classes is OOP
Stop repeating that. It's wrong.
>>
>>61304436
>registers
>ticks
We're not talking about computers here.
Computers are shit.
We're talking about writing programs in pure circuitry, WITHOUT computers, and running them by plugging them in.
>>
>>61304458
>Code that treats functions as properties of objects whose fields they use is OOP.
That is not an accepted definition of "object-oriented" in any book I've ever read, kiddo.
>>
>>61304466
No, it isn't.
>>
>>61304480
>in any book I've ever read
Then you should actually read one book in your lifetime, kiddo.
>>
>>61304480
It's not a definition at all, because definitions are biconditionals, and this is a one-way relationship. I never said OOP is the use of classes and methods. I said the use of classes and methods is OOP.
>>
>>61304473
you are fucking retarded. first a computer is not necessary made of circuitry. second, a circuit is not functional at all since a function is declarative while a circuit isn't.
>>
Whats the objectively best way to learn android programming?
>>
>>61304485
It is objectively wrong. Utility classes for instance are 100% procedural. Object-oriented code is code where responsibilities are delegated to objects.

Just because you stored pointers to sub-routines in some data structures, doesn't mean you're doing object orientation. You might not be doing any degree of object orientation at all, in fact. Just like using sub-routines doesn't make your code procedural - if you have code repetition and long sub-routines, you have failed to modularize your code into functions, which means your code is still imperative.

What classes really are is really just a way to store a table with method pointers (aka VMT). They were created with the intent of enabling you to create object-oriented code, but they can be used to create procedural code as well. Object orientation isn't a specific feature or set of features of a language, it's a programming paradigm.

>>61304487
Just tell me what's your source and I'll read it.

>>61304496
>I said the use of classes and methods is OOP.
And that's wrong.
>>
>>61304538
Writing android applications
>>
Working on Linked Lists in C, any tips?
>>
>>61304525
>first a computer is not necessary made of circuitry.
That's completely unrelated to anything. You were talking about registers and ticks. These are computer concepts. Therefore, your mentioning of them was erroneous.
>a circuit is not functional at all since a function is declarative while a circuit isn't.
An electrical component is indeed declarative, if the plastic casing is made right. A circuit is just a composition of components.
>>
Can someone explain something to me about Merkle Trees? If I have the root hash of an entire file in a p2p system, don't I still need all the pieces before I can construct a tree and compare the root hash? How exactly do I verify a chunk of data when I need the other chunks to recreate the tree?
>>
>>61303054
>exercises like these are a complete waste of time
Why?
>>
>>61304550
Alright, so it's not quite the same thing, I'll grant you that. But that doesn't change the fact that the possible code using classes that C++ would facilitate and make a lot easier to write than otherwise INCLUDES object oriented code.
>>
>>61304568
But what if one doesn't have enough knowledge to write them
>>
>>61304570
check pointers
>>
>>61304687
gooble
>>
>>61304687
Then you should learn how to write normal applications.
>>
wake me up when /dpt/.txt-senpai notices me
>>
>>61304712
but what if you know how to write normal applications but lack the necessary knowledge to write android applications
>>
>>61304726
>>61304709
>>
>>61304576
>An electrical component is indeed declarative
manifestly, you don't know what you are talking about. functions being declarative,

f(x) -> y where y * y = x

and

f(x) -> y where x / y = y

are equals but in circuitry they are not; they are only equivalent since the underlying effects are different.

functions are declarative, circuits are effective. this is literally first semester computer science.
>>
>>61304726
what are you having trouble with? you comfortable with java or c, right? get android studio and start reading, googling
>>
>>61304742
circuits don't define everything
>>
>>61304742
>f(x) -> y where y * y = x
>f(x) -> y where x / y = y
If this is what you mean by functions being declarative, you're wrong. Functions are not necessarily declarative in this way.
Functions are declarative insofar as they declare the number of parameters, the number of return values, and possibly the types. Circuits do all this.
Circuits do not declaratively define the relationship between inputs and outputs, but functions do not have to do this, either.
>>
>>61304725
Two of my posts made it to dpttxt
my biggest achievement in life so far
>>
I want to write cross platform application that runs on pc and mobile
>no you can't do that it's impossible
>*writes webapps because they run on all platforms*
Why the fuck can't there be some kind of POSIX like standard for hardware like camera, gps and stuff and also include functions to create window with opengl context?
>>
>>61304773
do you even know what is declarative knowledge? this is explained somewhere in the first ten pages of SICP. you are either trolling or truly retarded. in either cases, you are wasting my time; this conversation is now terminated.
>>
>>61304550
>Just because you stored pointers to sub-routines in some data structures, doesn't mean you're doing object orientation.
Fucking this. God damn that whole argument man.

It's easy to use OOP data structures for storage in any type of code.
But that doesn't make it OOP code. Makes it more OOP-compatible, but not full OOP.
You are just using one foundational facet that comprises OOP.

I do it all the time without ever using full-OOP features like inheritance and such.
I personally find inheritance fucking awful most of the time. Sure, "muh modularities!", but it sure is a fucking pain in a million asses to maintain it.
Sometimes, sometimes you just have to go, "when the fuck will I ever upgrade this single function? It is perfect as is, it doesn't need to be separate from the main class, fuck OOP-faggotry." and combine the damn functions.
Inheritance has its proper use-cases, and it is that in which large inheritance chains actually exist and are not created out of fucking bizarre abstractions that do not help anyone except retards that have a summer-course introduction to programming! Fucking literal summerfags, all of them.
Fuck UML especially. That shit is created for these retards. They are all boilerplate workers. Literally and figuratively curry to the development process!
>>
File: sicp10.png (1MB, 1327x1363px) Image search: [Google]
sicp10.png
1MB, 1327x1363px
>tfw havent programmed anything for a year
>>
>>61300536
Do 2D SDL instead.
>>
>>61304883
Yeah but see: >>61304668
>>
>>61303399
Imagine a rust based language with no borrow checkers
>>
damn it feel good to get paid
three months of neetness: never again
>>
>>61303281
nim
>>
>>61300771
If you take those Edx 'How to Design Program' courses 1 and 2, it will teach you binary trees, backtracking, ect. https://www.edx.org/course/how-code-simple-data-ubcx-htc1x course based off the classic HtDP book. It will also teach you types which will come in handy later if you learn C or a func lang.
>>
Hey /dpt/,

you lied to me. All those years.
JavaScript is great and i wish I would have started it earlier...

isPrime = num => { 
for(let i=2, s=Math.sqrt(num); i<=s; i++)
if(num % i === 0) return false;
return num !== 1
}

Array.apply(null, {length: 2000})
.map(Number.call, Number)
.filter(a => isPrime(a))
.reduce((a,b) => a+b)



>>61303786

Uhm..

The guy says that people are often interpreting Dunning.Kruger in a wrong way - and then he does the same.

The graphics have shown evidence that idiot overestimate themselves while brilliant people underestimate themselves.

So the "pop sci" version of dunning kruger ("the less you know, the more you think you know") is nto completely wrong, it's just inaccurate. It should be "the less you know, the more you overestimate yourself".
>>
>>61305339
>.filter(a => isPrime(a))
dumb nigger
>>
>>61305339
adding features to a garbage language doesnt make it not garbage
[1,2] == [1,2] // false
>>
>>61305407
>2 different objects have different references
dumb javascript poster.
>>
>>61305423
go ahead, compare two arrays by value in javascript
>>
>>61305434
>comparing by value in scripting language
dumb shitter.
>>
>>61305455
l-m-a-o
>>
>>61305407
"Reference types" were a mistake.
>>
>>61305479
Not pulling out of your mom was my mistake.
>>
>>61304101
>implying a circuit is not inherently procedural
You cannot reuse everything, you know.
>>
>>61305490
man man

heheehehehehe
>>
>>61305434
[1, 2].length === [1, 2].length  // true 
>>
>>61305099
Language to language compiled == trash
>>61305407
>>61305423
>>61305434
>>61305455
>>61305473
>>61305479
>>61305490
Hilarious how this is the one time where JavaScripts type system is consistent and an exception for convenience would have made more sense.
>>
>>61304375
>its size is that of any data pointer
It's the join of the sizes. Pointers to different types need not have the same size.
>>
>>61305519
by value, not attribute.
[1,2].length === [3,4].length
true
>>
>>61305546
How would it have made more sense? The objects are doing what objects do.
>>
sexpr to yaml compiler.

i want to start using Salt but there is no fucking way i'm going to write yaml by hand.
>>
>>61305546
The fact that most Javascript collections use === by default with no overridable behavior is a joke.
s = new Set(); 
s.add([1,2]);
s.has([1,2]); //false
>>
>>61304374
E.g. there is no way to do
void x = 5;
in C
you also can't return a value from a void function. so in that sense, it's a specific meaning that there are no void values, not that it lacks type information. the type specifically means there's nothing there (a type with 0 bytes). you also can't do anything like
struct {
void x : 8;
}
(which you could if it had no type information)
void * is the absence of type information in a pointer. void in arguments specifically means nothing, whereas
int f() { ... }
is the absence of type information because you can call it with args anyways (f(1, 2) works)
>>
File: IMG_0295.jpg (2MB, 4032x3024px) Image search: [Google]
IMG_0295.jpg
2MB, 4032x3024px
Just got the ANSI C book, but it looks kind of funky
>>
>>61305601
As a convenience exception for arrays where == compares their values if their size wasn't equal and === compares their references. How about every other type seems to work, just with less retarded type conversion.
>>
>>61305613
and on that note, how fucking retarded is sublime text? 3 lines of python would be able to express infinite levels of a sexpr tree, but since you have to use stupid ass yaml files to describe syntax highlighting, you get this shit instead:

https://github.com/selfsame/arcadia-repl/blob/master/clojure-dark.YAML-tmTheme
>>
>>61305618
you can't even pass a comparator function? lmao javascript is a joke
>>
>>61305631
that looks like a ``Pajeet Edition''
>>
>>61305572
>>61305618

You can't compare objects on equality in JS. The reasoning is that you could have private variables within objects.

But it's fairly simple to compare Arrays, a functional approach:

arrComp = (arr1, arr2) => {
return 0 == arr1.map((e,i) => (e == arr2[i] ? 0 : 1)).reduce((a,b)=>a+b);
}

console.log(arrComp([1,2], [1,2]));
>>
>>61305618
Oh well, you know what they say you shouldn't do: override Set and write a better one.

Put the old one under _Set.
Because fuck everyone else.
>>
>>61300449
fucking snakepeople
>>
>>61305690
>Language is so shit you have to override built-in methods
>>
>>61305657
Yep, you cannot override it. It always uses ===. Same with maps:
m = new Map();
m.set({ a : 1, b: 2 }, true);
m.get({ a : 1, b: 2 }); // undefined
>>
>>61305632
"Convenience exceptions" are inconvenient gotchas.
>>
>>61300449
A drone weapons stabilization system for ISIS
>>
>>61305696
At least it offers it.

>>61305698
oh god
>>
>>61305705
Not if they are consistent.
>>
>>61305705
Most modern programming languages are "EXCEPTIONAL".
This is the sad state of affairs in most languages today.
See that rule? Well fuck you buddy, time to go Full English on that shit and throw in exceptions everywhere.
>>
>>61301611
>Indeed. I'm think that primitive types of the language should get inferred and custom types should only get inferred if you name the values in initialization.
>Because otherwise you run into ambiguities all over once you add a type. Which is horrible. Future code shouldn't break programs like that.
You have no clue how type inference works.
>>
>>61301259
Fuck off, Imperialist Scum. You don't speak for a Hungarian Stamp Collecting Forum.
>>
>>61305723
The point of an exception is to break consistency.
=== tests reference equality for objects and == does the same with type juggling. Those are the rules of your language, now stick to them.
>>
>>61303399
lol thanks i'm not into politics
>>
>>61305736
This is why I don't get upset when I see things like .equals in Java.
>>
>>61305736
>implying old programming languages aren't full of exceptions.
void foo(int arr[])

arr is not an array.
>>
>>61305736
Haskell is pretty damn consistent imo.
>>
I'm creating a simple program that is meant to wait in the background until user presses the right key combination. How should I handle it so that the program doesn't cause unnecessary strain on the system or blocks other processes while waiting for input? Windows event loop with hooks? Are there any other approaches?
>>
>>61305757
>and == does the same with type juggling.
Except == assumes value types, except for "container" types. Which is inconsistent. Consistence would be having === compare all references and having == compare everything as value type except for objects with the option to override == in prototypes.
>>
>>61305849
user32.dll
>>
>>61305884
>Except == assumes value types
explain?
>>
File: 5pxsvzy7po1y.png (519KB, 829x671px) Image search: [Google]
5pxsvzy7po1y.png
519KB, 829x671px
>tfw Anthony Hopkins programmed hosts in JS and React
will /dpt/ NEETs ever recover?
>>
>>61305904
If == expect references only, 1==1 would be false, because there is no such thing as primitives in JS.
>>
>>61304883
>full oop features like inheritance
https://pdfs.semanticscholar.org/a850/7025bfa3b29d1efee53011d6ae4d76f4c325.pdf
Just saying.
OOP as a full fledged paradigm doesn't sit well with me but I can see it's purpose. But people erode what it means until it's just clumsy imperative programming (not clumsy because it's imperative programming but rather because they tend to make it clumsy).

So when on this topic I don't feel it's right to consider inheritance proper OOP.
>>
>>61305932
primitives aren't reference types, objects (including arrays) are.
>>
>>61305743
Anon it depends entirely on the system. You can easily make a type inference system that would break like this.
>>
>>61305952
>You can easily make a type inference system that would break like this.
It's a good thing none of the modern languages with type inference have this issue.
>>
>>61305949
>>>61305932 (You)
>primitives
There is no such thing in JS. Everything is an object in JavaScript.
>>
implementing type inference for java
>>
what do you do if fizzbuzzing won't ease the pain
>>
>>61305957
So? We weren't talking about current languages.
And most type inference systems I see aren't all that aggressive. When we're comparing to dynamic typing and where static typing should sit and what makes people have the idea that they dislike static typing the type inference system is completely up in the air. I just stated my opinion on a bound. Fucking moron.
>>
>>61305999
Bizzfuzzing.

That's the new hotness. Bitches get wet at bizzfuzzing.
>>
how do you guys proceed when starting to work with a new library? do you read the entire thing or cherry pick things that may be useful?
>>
>>61305999
take a long walk into the rain
>>
File: consider.jpg (29KB, 600x600px) Image search: [Google]
consider.jpg
29KB, 600x600px
new thread
>>61306028
>>
>>61306014
I look at its source.
I pick the shit out I need.
I delete the library.
>>
>>61305986
You're simply incorrect.
https://www.ecma-international.org/ecma-262/8.0/index.html#sec-ecmascript-overview
>Properties are containers that hold other objects, primitive values, or functions. A primitive value is a member of one of the following built-in types: Undefined, Null, Boolean, Number, String, and Symbol
>>
>>61306004
>We weren't talking about current languages.
what the fuck are you on about then?
>>
>>61306065
The document references to them as primitives, that doesn't make them primitives, though.
They have explicit constructors and methods but no explicit notion of boxing or unboxing, that makes them objects. The rest is just implementation details and JS inconsistencies.
>>
>>61306340
Those are indeed boxed objects. It's easy to check for yourself, so I don't know why you continue to say they'renot.
typeof true; // boolean
typeof new Boolean(true); // object
>>
>>61300449
OP, thread is dead, make another one with sand naggers, black people, jews or gay men holding SICP books to trigger /g/
>>
>>61306403
>It's easy to check for yourself, so I don't know why you continue to say they'renot.
They are internally and there are a shitload of other implementation details as well, but there aren't really boxing/unboxing mechanism other than type coersion.

On the other hand, I can do true.toString();
>>
>>61306503
>On the other hand, I can do true.toString();
Irrelevant. Methods don't make it an object, properties do and a primitive has no properties.
var bool = true;
bool.foo = 0;
bool.foo //undefined

The fact that this code runs without creating an error makes me nauseous, by the way.
>>
>>61306580
>Methods don't make it an object
That is where you are wrong, kiddo. An object isn't a compound type.
>The fact that this code runs without creating an error makes me nauseous, by the way.
Just another way JS pretends there are primitives.
But does it still works in strict mode?

Also, get over >>61306028 ,faggot.
>>
File: javaw_2017-07-10_16-01-33.png (72KB, 925x586px) Image search: [Google]
javaw_2017-07-10_16-01-33.png
72KB, 925x586px
The number is 32,875

If 32 in binary is 10000
If 875 in binary is 1101101011

The binary representation of 32,875 would be 10000,1101101011

But how the representation of 32,875 in 32-bit IEEE 754 is:
0 10000100 00000111000000000000000

>0
The sign 0 for positive

>10000100
Exponent 5+127 = 132

>00000111000000000000000
[1].00000111000000000000000, in brackets the hidden bit that means

1.000000111x2^5(binary) is equal 32,875(decimal)

To make it simple

100000.111(binary) is equal to 32,875(decimal)

which is not
>10000,1101101011

The first part 100000(binary) is 32(decimal)
How do you go from 0,875(decimal) to 0,111(binary) and not actually 1101101011(Number 875 in binary)?
Thread posts: 352
Thread images: 37


[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.