[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y ] [Home]
4chanarchives logo
/dpt/ - Daily Programming Thread
Images are sometimes not shown due to bandwidth/network limitations. Refreshing the page usually helps.

You are currently reading a thread in /g/ - Technology

Thread replies: 255
Thread images: 25
File: 1437233152222.png (593 KB, 950x1335) Image search: [Google]
1437233152222.png
593 KB, 950x1335
AI edition

Old: >>52188117

What have you used greedy search algorithms and neural nets for lately /g/?

Do not post unless you have read book in picture.
>>
>>52191963
First for Haskell.
>>
Second for Lisp
>>
>>52191963
>yfw the majority of people in this thread still think C is faster than C++

When will you actually learn the only other good language around (the other one being LISP, of course)?
>>
File: hgb.jpg (104 KB, 1280x720) Image search: [Google]
hgb.jpg
104 KB, 1280x720
>he uses the negative number meme in his code
>>
>OP still doesn't link the next /dpt/
dissappointing
>>
>>52192065
C is faster than C++ when you can't control which C++ features people on your team use.

Raw pointers are much, much, much better than smart pointers.
>>
>>52191963
>AI
I fucking hate weird Al.
>>
Daily reminder that if your language of choice is not on this list you should probably give up and kill yourself:
- C++
- C#
- Lua
- Python
- Elixir
- Haskell
- Bash
- Clojure
- D
>>
File: 4LbbDEv.webm (708 KB, 350x198) Image search: [Google]
4LbbDEv.webm
708 KB, 350x198
Ask your beloved programming literate anything.

>>52192065
http://benchmarksgame.alioth.debian.org/u64q/c.html
>>
>>52192109
This is false.
>smart pointers
No pointers is faster than pointers :^)
>>
Threadly reminder: ocaml and scheme are the only two good languages.
>>
>>52192145
>Ask your beloved programming literate anything.
Why do you think that means anything when there's no source code?
>>
>>52192145
Why are you so irreparably bad at programming?
>>
>>52192141
>no scheme
>no c
>no go
>bash
>c#
>c++
>>
>>52192149
>dynamic typing
>good
just give up anon
>>
How would I start when I wanted to make an Android app that just does the following things:

- shows a map of my current location
- shows my location as an arrow/a dot
- updates my location whenever I move.

Should be pretty simple, right?
>>
>>52192148
It's not false. In C++ it's very easy to write code that takes a retarded amount of time, but looks "OK". In C, it's always very obvious if what you're doing is going to take a long time.

I'm talking about architectural decisions here.
>>
File: autism.gif (973 KB, 256x186) Image search: [Google]
autism.gif
973 KB, 256x186
>>52192149
>>
>>52192176
There is source code? Click on the challenge, then the language.
Eg: http://benchmarksgame.alioth.debian.org/u64q/program.php?test=binarytrees&lang=gcc&id=3
>>
File: tumblr_n7ryizl1d61sy2geto1_500.gif (1011 KB, 500x245) Image search: [Google]
tumblr_n7ryizl1d61sy2geto1_500.gif
1011 KB, 500x245
>>52192176
>>52192196
Please don't bully.
>>
>>52192211
>you
>knowing what you're saying
Just give up anon
>>
>>52192109
unique_ptr has practically zero overhead over a raw pointer.
>>
>>52192228
In C++ it's easier to write code that runs faster than C code. Besides, if your team knows what they're doing it's easier to write faster code that can be used in many places and that can run faster than C code, simply because of the things C++ DOESN'T do at runtime.
>>
>>52192211
Typing is only useful if it makes your program faster. C is fast and has dynamic typing so your point is shit.
>>
>>52192245
Nice C with classes.
>>
>>52192355
If this is true, why does C outperform C++ in almost every benchmark?
>>52192145

>>52192375
>moving goalposts: the post
>>
>>52192366
Typing tremendously helps catch errors at compile time instead of runtime.
>>
>>52192366
C... has dynamic typing?
>>
>>52192366
It has static and weak typing.
>>
>>52192405
>he doesn't typedef everything to void
>>
>>52192394
Because retards like you prefer taking whatever random meaningless numbers are in your favor instead of looking at cold, hard facts like the code.
>>
>>52192366
Weak typing can't be called dynamic typing, I don't think.
>>
File: achnein.jpg (83 KB, 1280x720) Image search: [Google]
achnein.jpg
83 KB, 1280x720
Has anybody here ever worked with MIDI?

I was wondering if there's a good resource that explains the syntax of MIDI messages in detail: what the values mean, and how they're transmitted from a program to hardware.
>>
>>52192366
>Typing is only useful if it makes your program faster.
please don't have children. Static typing catches bugs at compile time that would otherwise not be found until run time. Dynamic typing is utterly useless. The only benefits it provides is that compilers are easier to write, and dynamic languages are easier for noobs to learn.

>C is fast and has dynamic typing so your point is shit.
C is a statically typed language. All statically typed languages can be do dynamic programming.
>>
>>52192421
But there is code? If C++ is so amazing why doesn't someone just copy paste the C code into it and then upload?

C outperforms C++. That's just a fact.
>>
>>52192425
Yeah, dynamic typing implies run-time type checking
>>
>>52192394
How was that moving goalposts? I never said C++ was fast if you don't know how to write C++...
>>
>>52192267
>Ignore this post.
What did he mean by this?
>>
>>52192433
> If C++ is so amazing why doesn't someone just copy paste the C code into it and then upload?
Wat?
>>
>>52192427
C has no types.
>>
>>52192435
The link was the C code... the C++ code is here: http://benchmarksgame.alioth.debian.org/u64q/program.php?test=binarytrees&lang=gpp&id=6

It even uses boost. What's more C++ than that?

>inb4 you think constructors and destructrors are faster than malloc/free
>>
>>52192457
I think you'll find it does anon. All languages have types.
>>
>>52192457
unsigned char
>>
>>52192459
I know, I saw the C++ code.
>>
>>52192447
Most valid C code can be modified into valid C++ code very easily. If C++ is such an amazing language that is faster than C, it follows that someone should be able to paste the C code of the faster solution into a C++ compiler, make a few minimal changes, and the resulting program should execute at either the same speed or more quickly.

The fact that C++ is consistently outperformed by C in benchmarks despite the languages being so similar implies that there are deeper architectural flaws with the C++ language.

In other words, C++ is shit.
>>
>>52192488
OK. So if "real" C++ code (and not just "C with classes" as you put it) can outperform C, why hasn't anyone managed to write it?

You suggest that fast C++ code is easier to write than fast C code. So surely it should be trivial to write a superior C++ implementation of the algorithm?
>>
>>52192065
What about people who actually worked in C the majority of their life and now work primarily in C++ now and KNOW that C++ isn't as fast?

Maybe the argument is that C++ is actually still fast enough and C speed advantage are so small it doesn't matter?
>>
>>52192546
If C++ is a superset of C, then how is it any slower than C?

I read years ago it was common to compile C projects with C++ compilers because they were more optimised. Am I missing something here?
>>
>>52192546
>50%+ performance differences is so small it doesn't matter
>>
>>52192472
A char can be treated as an 8-bit integer, an ASCII character, a boolean, a bunch of bitflags etc.
>>
>You're a super-villain and you want to prepare a transparency (the kind that goes on an overhead projector) with the key points of your plan for world domination so you can present them to the hero/superagent before you attempt to kill him in some ridiculously novel way. You don't want this information to fall into the wrong hands before you're ready. Smart villain that you are, you know you can share the information across several slides so that if the enemy agents capture any 2 of your slides, they won't learn even the tiniest bit of information about your plan. How?
is there a non-silly answer to this riddle?
>>
>>52192605
That doesn't stop it from being a type anon.
>>
>>52192459
C code:
https://benchmarksgame.alioth.debian.org/u64q/program.php?test=binarytrees&lang=gcc&id=3
C++ code:
http://benchmarksgame.alioth.debian.org/u64q/program.php?test=binarytrees&lang=gpp&id=7

>comparing average of 7 programs to average of 4 programs to determine which is fastest - not easiest to write in (which is C++ anyway)

CMEN
M
E
N
>>
>>52192605
the same goes for integers in haskell
does that mean haskell doesn't have types either?
>>
>>52192620
When the program is running there is no information stored about its type
>>
>>52192614
Three slides. One with an OTP key the decrypts the second OTP key, and the second OTP key decrypts the info on the slide.
>>
>>52192654
So? That's true of static typing in general (unless there's reflection).
>>
>>52192648
Haskell knows the type. In C its just bits.
>>
>>52192654
Yes anon. This is called type erasure. They are still types though.
>>
>>52192614
note that this is a computer science riddle
>if the enemy agents capture any 2 of your slides, they won't learn even the tiniest bit of information
it can mean that with 2 slides you will literally not even get 1 bit of information
>>
>>52192614
There is no valid silly answer to this riddle.
>>>/tumblr/
>>
>>52192656
nice
>>
>>52192625
It doesn't compare the average. What the fuck are you on? It takes the fastest.
>>
>>52192674
How does C not "know" the type?

C is weakly typed and Haskell is strongly typed, but they both have types.
>>
>>52192654
type erasure imposes some restrictions on static typing but that doesn't mean that the language isn't statically typed
>>
>>52192718
I see you don't know what you're talking about. As expected from a cmen.
>>
File: 3pnkbuj.jpg (32 KB, 720x405) Image search: [Google]
3pnkbuj.jpg
32 KB, 720x405
>>52192427
statically typed programming languages are doing everything to hide types (template, pattern matching, type inference, ...) because typing is a pain in ass. dynamic typing allows to avoid types to the most extent (type checking is explicit, you only use it when it's necessary) and offers more expressiveness than static typing, there only one argument in favor of static typing is performance, its supposed superior "safeness " has been dismissed by every studies on the subject.

http://danluu.com/empirical-pl/
>>
>>52191963
AI a modern approach is a shit book and should really be called AI a modern approach by 1890's standards.
>>
>>52192583
bump
>>
test
>>
>>52192733
I see you don't know how to write English.
>>
>>52192750
This link is a much fairer assessment of the performance of languages in practice (i.e. without theoretical infinite time as benchmarkgames).

It also clearly shows that static typing is a large advantage over dynamic typing, so thanks for ruining your own non-argument on your own.
>>
>>52192754
You're missing the fact that c-ucks know absolutely nothing about programming so they prefer spouting memes instead of observing reality. After all, nobody with any real programming experience would ever use C unless there is absolutely no other option (which never happens in practice).
>>
>>52192753
What's wrong with it?
>>
File: 9uy.jpg (68 KB, 1280x720) Image search: [Google]
9uy.jpg
68 KB, 1280x720
Press F12, go to "Console", type:

document.cookie


Post results.
>>
>>52192754
>>52192814
Because, as shown in Benchmark games, C outperforms C++. Ergo C++ compilers are shit, or C++ is a shit language.
>>
>>52192750
>because typing is a pain in ass
dynamic languages are typed too. Not sure what you mean here.

>dynamic typing allows to avoid types to the most extent
Dynamically typed languages still have just as many types as static ones. They are just checked at runtime instead of compile time. If you fuck up your types you code will still break, just not until runtime and discovering the cause takes a lot longer.

>offers more expressiveness than static typing
There's absolutely nothing you can do more expressively in a dynamic language compared to a static one. If you think I'm wrong please explain with an example.

>there only one argument in favor of static typing is performance
And productivity. Finding bugs at compile time with a lot of good information about what's wrong, is a lot better than finding the bug at run time with often not very good information about what went wrong. Besides that dynamic typing has absolutely no benefits.

> its supposed superior "safeness " has been dismissed by every studies on the subject.
I read that study. It states the results are inconclusive. You can't even read your own evidence.
>>
>>52192818
It presents almost exclusively antiquated approaches to AI and doesn't, in fact, present modern variants.
>>
>>52192838
>the language is one compiler
K
>>
>>52192228
> In C++ it's very easy to write code that takes a retarded amount of time, but looks "OK".
You forgot to add "... to a C++ novice".

People who actually use C++ don't e.g. blindly assume that assignment or passing parameters by value is O(sizeof(whatever)). That's for C programmers who think that they can apply the same mindset to C++.

More generally, they don't judge code on whether it "looks OK". You need to know what the types are, whether assignment, construction, comparison, conversion etc are O(1) or O(n) or worse (which is why the standard specifies this for the types it defines).

And if performance matters even slightly (i.e. always), you profile. If you don't know how to use a profiler (and interpret its output), you should probably just stick with Java/C#/VB/whatever.

And most of that isn't specific to C++. It applies to any language which has first-class values larger than what will fit into a register (which is pretty much everything except C, really).
>>
>>52192827
4chan_pass=meme
>>
>>52192827
"4chan_pass=_ALxNsa4p7EjPefzqVdZ8DnkoWb2cJfhT; ws_style=Yotsuba B New"
pls don't hack
>>
>>52192838
Case in point.
>>
>>52192838
>Benchmark games
How is that an objective comparison? It just get's two arbitrary solutions to problems written in different languages. Well written PHP could outperform shitty C.

Logically, I can see no reason C++ should be slower than C, since you can write anything you can write in C in C++.
>>
Any good references/tutorial on C++, C# and JavaScript? Planning on learning these on my 6 hour breaks once class starts.
>>
>>52192750
Have you even read the page? Nearly all the studies it cites either favour static typing or are obviously poorly done.

Do you really think a study about static vs. dynamic types is unbiased if all the participants are Ruby programmers?
>>
>>52192862
Is there a better performing C++ compiler in the general case than GCC?

>>52192888
You realize anyone can submit code, yeah? And they only show the best solutions. If what you're saying is true then submit the fastest C solution as a C++ solution and see where it takes you.

C++ is slower than C, even when it's literally the exact same code. Explain that.
>>
How do you study a big project?
Where do you start?
>>
>>52192871
Y-you wouldn't lie to me, w-would you?
>>
>>52192907
>C++ is slower than C, even when it's literally the exact same code. Explain that.
I can't, can you? If they are using the same compilers I would expect the to output identical binaries.
>>
>>52192827
I have too many good shitposts in this thread to let you delete them.
>>
>>52192907
>Is there a better performing C++ compiler in the general case than GCC?
clang
>>
>>52192854
Even the 3rd version? Sure it doesn't have the latest and greatest ML stuff, but I don't see how it's that bad for an intro book.
>>
MODS ARE ASLEEP POST BARELY VALID C
>>
>>52192940
I promise I won't.
>>
>>52192954
void all_image_extract(unsigned char* data, unsigned char* target){
int on_image = 0, on_image_test;
int i, i2 = 0;
for(i = 0; i < image_size - img_str_len; ++i){
int j;
if(!on_image){
on_image_test = 1;
for(j = 0; on_image_test && j < img_str_len; ++j)
on_image_test = on_image_test & (data[i+j] == img_string[j]);
on_image = on_image_test;
}
if(on_image && data[i] == '"'){
on_image = 0;
target[i2++] = '\n';
}
if(on_image){
target[i2++] = data[i];
}
}
target[i2++] = '\n';
target[i2++] = '\0';
}
>>
>>52192907
>Is there a better performing C++ compiler in the general case than GCC?
Don't know, and I wasn't implying that there was.

If you look at the ideas presented in C++ versus the ideas presented in C you can easily see that C++ would easily outperform C if the compilers were at the same level. And we're only discussing very specific algorithms here, because in most cases C++ is faster than C already, when C compilers are much older and C++ compilers are much MUCH more complex to write and optimize. I can assure you that if you actually wanted to use those algorithms in a half useful context you would get much better results than C++.

If you can't see this you're effectively holding programming back.
>>
File: few.jpg (95 KB, 676x676) Image search: [Google]
few.jpg
95 KB, 676x676
>>52192954
>he thinks mods have to be asleep for us to shitpost

/dpt/ is pretty much hands-off moderation, that's what I like about it.
>>
>>52192935
It's not the same compiler, there are things that cannot be the same due to RAII, and that prety much explains it.

G++ != GCC + C++

It's just much more to optimize.
>>
>>52192987
mods are afraid of our intelligence
>>
>>52192897
>obviously favor
All the ones on development time show dynamic soundly beating static, besides Haskell where the necessary code is 1/10 of the other languages.
>>
test
>>
>>52192976
>results than C++.
with C++*
>>
>>52192827
4chan_pass=_0VHAOGJXkzQtlDeb9MdZovhr48ycpfjU


I swear to god senpai, if you do something naughty with this info I'm going to get you.
>>
>>52193065
>buying a cuck pass
>>
>>52192141
>Lua
>C++
>D
no thanks pham
>>
>>52193084
Non-pass users have that cookie too.
>>
>>52193084
>he doesn't post in the 4chan gold lounge
>>
>>52192909
from the documentation
>>
>>52193018
Let's go through the studies that show dynamic beating static in development time.

>My interpretation of this is that, if there is an effect, the effect is dwarfed by the difference between programmers, and it’s not clear whether there’s any real effect at all.

>However, since the scripting language group had significantly different (and easier) environment than the C-like language group, it’s hard to say how much of the measured difference in implementation time is from flaws in the experimental design and how much is real.

>The author find a statistically significant difference in time to complete the small task (the dynamic language was faster) and no difference in the time to complete the large task.
>There are a number of reasons this result may not be generalizable. The author is aware of them are there’s a long section on ways this study doesn’t generalize as well as a good discussion on threats to validity.

>Subjects came from a local Ruby user’s group. Subjects implemented a simplified sudoku solver and a maze solver. DRuby was randomly selected for one of the two problems for each subject. There were four subjects, but the authors changed the protocol after the first subject. Only three subjects had the same setup.
>The authors find no benefit to having types.
This is my favourite.

>Metrics were all self reported, and no guidelines were given as to how they should be measured, so metrics varied between subjects. Also, some, but not all, subjects attended a meeting where additional information was given on the assignment.

I'm out of characters but I think you get the idea. I'm not cherry-picking, either, I'm taking a quote from every pro-dynamic-typing study's summary as I go down the page.
>>
>>52192987
this

some of the shit i post here could get me banned in other boards

...i speak from experience
>>
>>52193139
>tfw banned from /pol/ for shitposting, but free to post in /dpt/ all i want
>>
Explain the 4chan cookies and local storage to me, /dpt/:
//Cookies
4chan_pass
_cfuid

//Local storage
4chan-cd-g
4chan-cd-g-tid
4chan-settings
4chan-track-52191963
4chan-track-g-ts
>>
>>52193155
>tfw on /dpt/ I am easily able to spread false information to lurkers that simply believe statements they read here
it's even better when no one replies to call me out, people will trust me more easily
>>
>>52193130
As to be expected of dynamic fags. Even their studies are dynamically typed.
>>
>>52193065
>no one has deleted my post yet
smdh tbqh family
>>
>>52192907
> C++ is slower than C, even when it's literally the exact same code. Explain that.
Well, one common mistake amongst C programmers who know just enough C++ to be dangerous is forgetting to add throw() (or noexcept) to function definitions. C functions have it implicitly, C++ functions have to propagate exceptions unless either the compiler can reliably determine that they cannot occur or it's explicitly told to ignore them.

There are a bunch of other cases where a C++ compiler has to consider possibilities that can't occur in C. The result is that using -O<n> (and nothing else) for optimisation typically does more for you with C than with C++. To get "equivalent" behaviour for C++ you also need a bunch of -fno-whatever switches it to tell it that certain possibilities (which can't occur in C) don't need to be allowed for.
>>
Literally zero reason anybody should program in C in the year 2016. The time of minicomputers and unix is gone.
>>
>>52193181
The 4chan_pass is just the pass ID that's present even if you don't have an actual pass, don't know about _cfuid, the cd-g, cd-g-tid, and -settings keys are for the extension settings storage, the track keys are for Hiroshima to collect and sell your data.
>>
>>52192851
>I read that study. It states the results are inconclusive. You can't even read your own evidence.
that's exactly what i have said: the only valid and verified argument for static typing is performances enhancement.

>>52192851
>There's absolutely nothing you can do more expressively in a dynamic language compared to a static one. If you think I'm wrong please explain with an example.
anyone who did PL theory 101 know that a static typing system must be decidable and thus forbids all undecidable but valid programs contrary to dynamic typing.
>>
>>52193245
>The 4chan_pass is just the pass ID that's present even if you don't have an actual pass
It's a password for your posts so you can delete them.
>>
File: job-interview.jpg (20 KB, 292x219) Image search: [Google]
job-interview.jpg
20 KB, 292x219
>It says here you are expert in non-trivial solutions. Please, clarify this to me.
>>
>>52193277
>I never learn the standard libraries but I always get the problem solved.
>>
File: ou.png (142 KB, 511x564) Image search: [Google]
ou.png
142 KB, 511x564
Think I'll go get /a/ mad by giving them subtle hints that I'm a crossboarder.
>>
>>52193248
>static typing system must be decidable
Wrong.
>forbids all undecidable but valid programs
Even wronger.
>>
>>52193248
>that's exactly what i have said:
You said:
>it's supposed superior "safeness " has been dismissed by every studies on the subject.
Which is utterly untrue. I even have to qoute your own posts back to you, let alone that fucking article.

>anyone who did PL theory 101 know that a static typing system must be decidable
true
>thus forbids all undecidable but valid programs
not remotely true you complete tard. Static Typing is a language feature and not everything has to be safely statically typed. I can't think of a language that even does this. Maybe Haskell.

You can turn off the type system easily in almost any statically typed language whenever you like. In Java you can declare everything as an object, and as such types won't be verified until run time, like any dynamically typed language.

I must have talked to 20 dynamic typing advocates in the past few years with good intentions in hopes of learning something about dynamic typing I didn't know before. But literally every single time they are simply ignorant about the basics of type theory.
>>
>>52193248
Yes, strictly speaking, a language with dynamic types can express more programs than a language with static types. Are those programs useful to express? Do those programs themselves run without error? Likely not.
>>
>>52193349
>Strictly speaking, a language with dynamic types can express more programs than a language with static types
Not who you're replying to. But this isn't even true.
>>
>>52193311
Just posted this:
>>>/a/135580571

Lets see their reaction. inb4 banned there.
>>
>>52193344
>But literally every single time they are simply ignorant about the basics of type theory.
So are you.
>You can turn off the type system easily in almost any statically typed language whenever you like.
You can't.
>>
>>52193363
Static type checking is conservative by definition, unless you want it to be undecidable. There will always be "false negatives".

But it's like having "more than infinity", in practice it doesn't matter.
>>
>>52193363
It is, because the program that calls an arbitrary function on an arbitrary object that cannot possibly have that function defined on it is admissible in a dynamic language but not a static one. Likewise, calling nonexistent functions is admissible in dynamic languages alone.
>>
>>52193311
It doesn't take much to trigger /a/, just got to find a way to break their waifu circlejerk
>>
>>52193370
>auto
>var
>inference
>void*
>object
>>
>>52193368
>>>>/trash/
>>
>>52193370
>So are you.
Unless you can provide an example of something I have been wrong or ignorant about regarding type theory, I'm somewhat sceptical of that.

>You can't.
Object car = new Car();
Person p = (Person)car;

wow look, this compiles in Java, even though it will fail at runtime with a type error. This isn't even exoctic code in any way, it's extremely normal to write code like this in Java when it makes sense.
>>
So, here's my problem.
I want to create a solvable maze in a 2D array.
But I have no idea on how to implement the walls.
I thought about using int values (1,2,4,8) which represent the 4 walls around a matrix cell, for example
1 = wall left
2 = wall top
4 = wall right
8 = wall bot
a cell with a value 3 means it has a wall both top and left.
but this gets tricky considering walls are "shared" between cells, so I probably should just stick to using "black" cells to define the walls, and "white" cells to define the empty space.
What is the best option, /g/? Consider I'm doing this just as an exercise
>>
>>52193405
auto/inference is not "turning off the type system". The same typing guarantees (that is, producing a correct program) are there.
>>
Best programming language for high performance authentication server that will be pounded like crazy at all times?
>>
>>52193430
Brainfuck.
>>
>>52193430
Erlang
>>
>>52193430
The Ur language is basically tailored precisely for this.

OCaml with ocsigen is also a good option.
>>
>>52193430
C
>>
>>52193383
>because the program that calls an arbitrary function on an arbitrary object that cannot possibly have that function defined on it is admissible in a dynamic language but not a static one.
This is not something you want to do in any language. It's not exactly a use case. This is a bug.

>calling nonexistent functions is admissible in dynamic languages alone.
C#:
Func<void, void> muhFunction = null;
muhFunction.involke();

It's not so hard.
>>
>>52193464
Ur is better. It is much safer and easier to program in, and https://www.techempower.com/benchmarks/ shows that it is the second fastest option by far (right behind urlib in C++).
>>
>>52193471
That's not a function, it's an object. You also didn't call a nonexistent function, you accessed a field on a null object. Not even remotely the same thing.
>>
>>52193446
Yeah been thinking about it, how about Go? I heard it's been made specifically with concurrency/networking in mind but there's probably no fault tolerance and shit...

>>52193453
>Ur also called Ur/Web is an open source functional programming language specific for web development
>web
No thanks.

>>52193464
“Program received signal SIGSEGV, Segmentation fault."
>>
>>52193416
what if person extends car though u idiot
>>
>>52193510
Then that would be valid code anon, did you not know that?

I was doing my best to imply that Person does not extent from Car, since I think most people understand that a Person is not a Car. I guess I expected too much though.
>>
>>52193508
>I don't want to use a web development language to develop my web application despite the fact that I require the best performance and this language offers just that
>>
>>52193349
> Yes, strictly speaking, a language with dynamic types can express more programs than a language with static types
Uh, I guess it depends upon how you count "more programs". I mean, isn't a Turing machine statically typed?

Ultimately, I don't think that those kinds of "limit" definitions are interesting. E.g. any program which can be written in any language can be written in asm or BWPs or brainfuck. Or you can create an exe with a hex editor.

But that's a rather weak notion of equivalence. Anyone sane would rather use a real language than a hex editor. E.g. having to hand-edit every offset in the binary because you inserted one instruction isn't exactly productive.

So, on the one hand dynamic typing can let you construct valid (well-typed) programs that can't be constructed in any existing static type system (at least, not those found in mainstream languages, and I'm including Haskell with all of the reasonably-mature type extensions in that definition).

On the other hand, dynamic typing is *far* more often used to "allow" the construction of invalid programs. For every genius who creates some advanced type system, there are a million code monkeys who created buggy programs because they didn't have the compiler statically analysing their types.
>>
>>52193556
When did I ever mention that I'm writing a web application?
>>
>>52193569
Oh, absolutely. I'm of the camp that sees sufficiently advanced types as a way to completely bypass (manual) unit tests. I'm just playing devil's advocate.
>>
>>52193508
Go is quirky in some ways (pointer receivers vs value receivers for instance, I don't like the fact that the first letter decides encapsulation either) but decent in other ways.
Channels are good for any non-stateful problem, for stateful problems, you'll still end up using mutexes.

>but there's probably no fault tolerance and shit
I'd say this isn't exactly true. In Erlang you need this kind of fault tolerance because your "exceptions" blow up your program, so you need proper handlers for those situations.
In Go errors are just values and Go forces you to handle the error directly in almost every case (unless the only return value is an error). This results in more code, but the resulting code is pretty robust because you are handling all possible errors (except for some errors you cannot recover from, like OOM) explicitly at every level.
The advantage of exceptions is that they require less boilerplate if used correctly because they can move multiple levels up the callstack without you writing any code, but at the same time, you run the risk of accidentally blowing up the application.
Erlang solves this issue with a great handling strategy while Go solves it by not having you use exceptions at all.
>>
>>52193570
At the point where you said you wanted a language for your web application and asked for recommendations. Quote: "Best programming language for high performance authentication server that will be pounded like crazy at all times?". Remember that part? Yes? Take your meds. No? Go see your doctor.
>>
>>52193540
>I was doing my best to imply that Person does not extent from Car, since I think most people understand that a Person is not a Car
are you telling me you're too fucking poor to have ever watched a transformers movie? they're literally car people
>>
>>52193600
>>52193600
>authentication server means web
Kek.
>>
Anyone have some resources on reading from/to file in C++?
>>
>>52193593
Go performance is crap, though. C++, Ur, Clojure and Java, in that order, are significantly better options.
>>
>>52193593
Thank you, that was insightful.

>>52193600
>At the point where you said you wanted a language for your web application and asked for recommendations. Quote: "Best programming language for high performance authentication server that will be pounded like crazy at all times?". Remember that part? Yes? Take your meds. No? Go see your doctor.

Are you sure that's me who needs meds? I'm not seeing any mention of web server in my post.
>>
>>52193593
>Go forces you to handle the error directly in almost every case
file, error := os.Open("wahey.txt")
// ignore "error", start using "file"
>>
>>52193507
>That's not a function, it's an object.
Functions can be objects anon.

>You also didn't call a nonexistent function, you accessed a field on a null object. Not even remotely the same thing.
okay, I'll do better for you.
var muhDict = Dictionary<string, object>();

muhDict.add("muhFunction", () => { Console.WriteLine("Dicks"); });
//muhDict is the same as an object in a dynamic language.
//This one has a member called muhFunctiion which is, a function.

muhDict["muhFunction"](); //we call the function we made.
muhDict["muhNonExistingFunction"](); //we call one we never made. This causes a runtime error.

This is all dynamic languages are. Anything you can do in a dynamic language can easily be done in a static one. Yes, it's not as clean here as it would be in a dynamic language, but the performance, behavior and logic is exactly the same. That said, it's hard to come up with a useful reason to do anything like this.
>>
>>52193610
Yes, that is indeed what it means, given the exact same meaning as in Ur/web.
>>
Left: Program made in Python

Right: Program made in C++
>>
>>52193612
fread, fwrite, fopen, fclose
>>
>>52193628
You're not calling a function that doesn't exist, you're applying the () operator to the output of a dictionary's value for a key that doesn't have an entry in the dictionary. You clearly have no clue what you're saying, just stop embarrassing yourself already.
>>
>>52193618
C++ maybe. Go's advantage in regards to performance is that it allows you to write cache coherent code, which isn't really possible in languages like Java or Clojure (no clue about Ur).
Another issue is heap allocation. Java and Clojure both allocate everything on the heap, Go does escape analysis. This reduces the work load on the GC and generally improves throughput.
I'd also like to mention that if your application is doing lots of concurrent work, then Go will be more performant than Java or Clojure either way, because it uses segmented stacks and green threads.
A light goroutine only costs 4KiB, while a light thread costs half your stack (Sure, you can do pooling, but that reduces throughput).
The JVM is generally more performant in regards to the code it produces, but in regards to concurrency and code where you are able to optimize for cache coherency, Go might have the upper hand.
>>
File: efw.jpg (114 KB, 640x960) Image search: [Google]
efw.jpg
114 KB, 640x960
How do I become a web dev, /dpt/?
>>
>>52193687
>you're applying the () operator to the output of a dictionary's value for a key that doesn't have an entry in the dictionary.
What do you think objects are in a dynamic language?

What do you think is happening in when I do this in JavaScript?
var muhEmptyObject = { };
muhEmptyObject.muhFunction();
>>
>>52193703
See https://www.techempower.com/benchmarks/
Reality trumps theory every time.
>>
>>52193627
func foo() (int, int) {
return 0, 0
}

func main() {
a, b := foo()
}


prog.go:8: b declared and not used

You have to explicitly ignore the error return with _.
It doesn't matter if you can ignore it, what matters is that you are made aware that there can be an error, which isn't essentially the case with exceptions.
>>
>>52193735
Whatever, same thing. Errors using discriminated unions (Maybe, Either Error, etc.) are far superior because they actually force you to handle them, and they can be propagated monadically like exceptions.
>>
>>52193717
Since you're retarded, I'll give you a little help.
x = 9999
if x = 5:
nigger_function(dicks, faggot, cunt)
else:
jew_function(oven, interest, dosh)

No need to thank me! Maybe one day you'll be as smart as I was before I left my mother's womb! Don't give up!
>>
Has anyone here ever used a union?
>>
>>52193762
What exactly are you trying to show me here?
>>
>>52193783
Yes, to access similarly-aligned fields (non-portably) on structs.
>>
>>52192207
>recommending go
>clearly not advanced enough to use generics yet
>>
>>52193757
A mix of both is the best. Rare, typically unrecoverable conditions should be handled by exceptions, but common, easily recoverable conditions should use discriminated unions.
Example: Dictionary.find d "hello" -> None | Some Dictionary.Key.t but File.open "doesnot.exist" -> Not_found (or Missing_permissions or Out_of_handles, ...)
>>
>>52193783
If someone hasn't used (C-style) unions yet, they really shouldn't pretend to know anything about any kind of programming.
>>
>>52193783
>32-bit value for RGBA
>8-bit values for R, G, B, A
Yes, unions are very useful.
>>
>>52193757
>because they actually force you to handle them
There always is a way to ignore them, like simply piping the error action into an infinite loop that does nothing.
But as I said, that doesn't really matter. Pragmatically, when I am programming, I care about the compiler informing me about possible errors, not about the fact that I *might* be able to ignore them.
>>
>>52193860
>There always is a way to ignore them, like simply piping the error action into an infinite loop that does nothing.
>using languages without totality checking
>>
>>52193854
What are you implying here? A union of a struct with 4 8 bit fields and a 32 bit int? Because that's not portable.
>>
File: fedora.jpg (66 KB, 613x677) Image search: [Google]
fedora.jpg
66 KB, 613x677
>He uses cpp.sh to compile his code
>>
>>52193897
How is it not portable?
>>
>>52193875
>totality checking
(Sadly) those languages lack in other areas and aren't very practical yet.
>>
>>52193928
I'm gonna change that.
>>
>>52193906
bookmarked, thanks
>>
>>52193928
>not knowing how to write total functions
>>
>>52193854
>32-bit value for RGBA
>8-bit values for R, G, B, A
Or is that A,B,G,R?

(Answer: it depends upon the architecture).

Unions have legitimate uses. Type punning isn't one of them.
>>
>>52193922
Say you load a value accessing the int field of the union and then try to access the red component using union.structname.red
That's not portable (it's implementation-defined behaviour, iirc)
>>
>>52193958
>Type punning isn't one of them.
It most certainly is, you just have to be mindful of when you use it and be aware that it's not portable.
>>
>>52193954
>shitposting all day long
don't you have an assignment to get done?
>>
>>52193875
>>52193928
>falling for the totality meme

>This FizzBuzz runs forever.
>This FizzBuzz takes 6 million years to terminate.
>>
>>52193958
>I am clinically retarded and nobody can stop me!
>>
>>52193961
And you would also never do that so what's your point?
>>
>>52194010
Then what's the point of having the union in the first place
>>
>>52193987
Totality is very important when the code isn't actually going to be run, only type checked (propositional equality, for example).
>>
>>52194034
Go back to your fizzbuzz, kid, adults are talking.
>>
Threadly reminder that you should not refer to the act of programming as coding. It is improper and makes you look like a 15 year old

You are a programmer, not a coder
>>
File: sicppat.jpg (286 KB, 1024x768) Image search: [Google]
sicppat.jpg
286 KB, 1024x768
>ITT: First year cs undergrads doxa

There are people who still believe in dynamic typing > static typing (or inversely) ?

>>52193783
As a code artisan: yes, many times. For example, for my software renderer, i did

typedef struct
{
U8 red;
U8 green;
U8 blue;
U8 alpha;
} RGBA;

typedef struct
{
U8 blue;
U8 green;
U8 red;
U8 alpha;
} BGRA;

typedef struct
{
// ...
} ARGB;

typedef struct
{
// ...
} ABGR;

typedef union
{
U8 u8;
U16 u16;
U32 u32;
RGBA rgba;
BGRA bgra;
ARGB argb;
ABGR abgr;
} Pixel;

typedef union
{
U64 u64;
struct
{
Pixel high;
Pixel low;
};
} DoublePixel;


typedef union
{
struct
{
R32 x;
R32 y;
R32 z;
R32 w;
};
__m128 m128;
R32 elements[4];
} Vector;

typedef union
{
struct
{
Vector vX;
Vector vY;
Vector vZ;
Vector vW;
};
__m128 m128[4];
Vector vectors[4];
R32 elements[16];
} Matrix;
>>
>>52193710
Depends on what kind of web development you want to do.

What are you interested in?
>>
>>52193710
You could also become a weeb dev, like me.
>>
>>52194102
>code artisan
Stop shitposting.
>>
File: hb.png (2 MB, 1920x1080) Image search: [Google]
hb.png
2 MB, 1920x1080
Sore ga Seiyuu! is pretty comfy /tbq?h/.
>>
Gonna go on a 3 hours coding session,

Need some music reccs
>>
How the fuck can I do serialization in C++ without STL?
I've got school project but we're forbidden from using STL, and every fucking file handling guide tells you to use STL.
>>
>>52194197
fwrite and fread
>>
>>52194194
Deathconsciousness - Have A Nice Life
>>
>>52192057
that's pretty cool

I've only ever screwed around with known rulestrings, mostly Maze and Mazectric so I could easily generate sweet-looking mazes
>>
>>52194197
Open the STL file and copy anything there to your new function called Totally_Not_STL
>>
>>52194194
Porter robinson worlds
>>
File: laug.webm (3 MB, 1280x720) Image search: [Google]
laug.webm
3 MB, 1280x720
>>52194147
>not being a programming literate.
>not being a code artisan crafting his own programming tools.
Read SICP or be doomed to mediocrity.

>>52194194
Eurobeat ultramix
>>
>>52193985
not knowing how to reduce on one or more arguments every time you recurse :'(
>>
>>52194194
Shrek Soundtrack
>>
>>52194236
"It was the opposite for me. Learning to program felt like becoming a wizard. Every day I learned a new incantation, and as I came to understand the deeper rules of magic, I realized I could make nearly anything I could imagine become real, with enough time and effort.

I'll never forget the feeling of seeing what I imagined appear on the screen." -- Anonymous

I would prefer to call myself a magician, not a code artisan
>>
>>52194194
https://www.youtube.com/watch?v=wEmJH7JsKgM
>>
>>52194266
I prefer the term meme writer, or memer for short.
>>
>>52194194
>2016
>not programming in wu tan/g/


https://www.youtube.com/watch?v=BiXa3nGexX8
>>
>>52194054
How about you give me a proper answer?
>>
What does /dpt/ think about the Free as in Freedom massively multiplayer online role-playing game called Planeshift?
>>
>>52194361
more like plain shit, amirite
>>
File: 799fb5b4.jpg (52 KB, 1280x720) Image search: [Google]
799fb5b4.jpg
52 KB, 1280x720
>>52194266
Free as in freedom? So not GPL then?
>>
File: 1451427716122.jpg (226 KB, 500x700) Image search: [Google]
1451427716122.jpg
226 KB, 500x700
What do you think about local auxiliary functions in python? Is it good style?

def test_randoms():
def random_genus_2_weirstass(p):
x = SR.var('x')
f = x^5
for i in xrange(0, 5):
f += ZZ.random_element() * x^i
return i

P = Primes()
p = P.next(3)
while p < 100:
f = random_genus_2_weirstrass(p)
H = CanHyperCurve(2, f)
if sorted(list(H.division_points(3, p))) != sorted(list(H.division_points_naive(3, p))):
print "failed: p=" + str(p) + " f = " + str(f)

>>
>>52194393
Meant for:
>>52194361

smdh
>>
>>52194397
MEME
>>
>>52194393
>animefags dislike freedom
As expected from those who watch the japanese jew.
>>
File: 8u.jpg (50 KB, 640x360) Image search: [Google]
8u.jpg
50 KB, 640x360
>>52194426
I like freedom, that's why I don't like GPL.

GPL is not freedom.
>>
>>52194445
Good go- gwailo- I mean, good gaijin!
>>
>>52194445
BSD fag plz.
>>
File: 5NrHPaJ - Copy.jpg (271 KB, 720x720) Image search: [Google]
5NrHPaJ - Copy.jpg
271 KB, 720x720
>>52194445
BSD is GOAT
>>
>>52194445
Yes, because you're a twat trying to make money off proprietary software by using free software.
>>
>>52194393
sauce ?
>>
>>52194472
>supporting communism
good goy
>>
>>52194504
Yuru Yuri
>>
File: ug.gif (489 KB, 458x260) Image search: [Google]
ug.gif
489 KB, 458x260
>>52194502
>You shouldn't be allowed to put strings of text in your proprietary software because king Stallman said so
>>
>>52194571
>>>/a/
>>>/out/
>>>/lgbt/
>>>/trash/
pick any combination, just fuck off.
>>
>>52194571
No, I should be allowed to stop you from doing that if I wish.
>>
File: h.jpg (98 KB, 317x299) Image search: [Google]
h.jpg
98 KB, 317x299
>>52194587
>He thinks he could find out if I was using GPL code in my proprietary software
>>
>>52194627
Why do you care about the GPL if you're not afraid to violate it, then?
>>
>>52194652
I just think it's a meme, if you're feeling generous you should release your code with a MIT/BSD licence, more good will come from it if people are allowed to use it however they want.
>>
>>52194693
What if I don't care about people getting to copy and paste it into their code base, but I am happy to let them modify my application and study the code to learn the techniques behind it?
>>
How long does it take to get used to lisp (scheme) syntax when coming from languages like C, C#, and ruby?
>>
>>52194788
lemme give you a quick rundown
Day 1:
(((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((

Day 2:
)))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))


Day 3:
Suicide.

You're now a memelord.
>>
>>52194505
>supporting slavery
Good gwailo
>>
>>52194803
XD le Large Incomprehensible Strings of Parenthesis meme

;; Absolute value function
(define (abs x)
(cond ((> x 0) x)
((= x 0) 0)
((< x 0) (- x))))


r8 my abs
>>
>>52194831
Why is your top one off centered? You should see a doctor about that.
>>
>>52194831
>>52194869
But seriously why even bother checking the zero? -0 is still 0.
>>
>>52194869
(define (abs x)
(cond ((> x 0) x)
((= x 0) 0)
((< x 0) (- x))))

Doctor doctor give me the news
>>
Does anybody have link to the MIT python course?
>>
>>52194888
Poor.
(define (abs x)
(if (< x 0) (- x) x))
>>
>Go has no round function
Nigga, like that's a basic requirement for a math library.
>>
>>52194831
Single function
))))                                                                                                                                                fucking awful
>>
>>52194905
Add .5
>>
>>52194192
Doesn't every slice of life moeblob anime feel the same to you after a while?
Surely, you don't go around watching every one and claiming to enjoy them all.
Thread replies: 255
Thread images: 25

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

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.
If a post contains personal/copyrighted/illegal content you can contact me at [email protected] with that post and thread number and it will be removed as soon as possible.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com, send takedown notices to them.
This is a 4chan archive - all of the content originated from them. If you need IP information for a Poster - you need to contact them. This website shows only archived content.