[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: 331
Thread images: 30

File: 1485438720022.png (423KB, 720x720px) Image search: [Google]
1485438720022.png
423KB, 720x720px
Old thread: >>60816224

What are you working on, /g/?
>>
File: 1496872967501[1].jpg (302KB, 1560x2048px) Image search: [Google]
1496872967501[1].jpg
302KB, 1560x2048px
I want to branch out from webdev and go for something bigger.
Should I learn Python on top of my PHP/MySQL/JavaScript leet pro mega skills?
Should I get into deep learning?
Should I hire myself out to companies, or try to develop software and promote and sell it later?
>>
>>60820727
I want jacks to make computer ZOOOOOOOOOOOOOOOM VERY FAST
THX
>>
>>60820749
Just do it.
>>
File: 1482636638202[1].jpg (56KB, 825x692px) Image search: [Google]
1482636638202[1].jpg
56KB, 825x692px
>>60820759
I'll just do it as soon as I find out what "it" is. Thats why I am asking.
>>
>>60820749
Hire a team, create a new cryptocurrency, ICO, profit.
>>
One easy way to know the person is a moron
x ^= y;
y = x ^ y;
x ^= y;
>>
Why does it not place them decrementally on the stack!?

int a = 2;
int b = 3;

gcc translates to asm as

movl $2, -16(%rbp)
movl $3, -12(%rbp)


when logically the stack grows downwards to the lower adress so it should had been

movl $2, -12(%rbp)
movl $3, -16(%rbp)

I see that a objdump -d indeed places them correctly in the stack.Why does the asm generated by gcc not place them correctly?

727: c7 45 f0 02 00 00 00 movl $0x2,-0x10(%rbp)
72e: c7 45 f4 03 00 00 00 movl $0x3,-0xc(%rbp)
>>
File: 1495828847591.jpg (428KB, 980x1040px) Image search: [Google]
1495828847591.jpg
428KB, 980x1040px
>>60820727
Rewriting Haskell in untyped lambda calculus.
>>
File: coke-4.jpg (30KB, 600x600px) Image search: [Google]
coke-4.jpg
30KB, 600x600px
if you want to open a bottle, you just fucking do it, you don't have to recite a string of words like "righty tighty, lefty loosey" to figure out how to do it

you haven't truly learned something unless you've internalized it past the word description of it

this applies to everything including math and programming etc

you'll suck at problem solving etc if you're unable to reason with things intuitively
>>
>>60820796
>writing a type-checker
ok
>>
Who here /moron/?
It's so unfair, I didn't choose to be a moron.
>>
I know most of the web runs on PHP, but thats for historical reasons. There is just a lot on the web that was build years ago.
What does the NEW web run on? New websites, new web applications, what are they written with and what do they run on?

inb4 opinions
post some surveys or stats or whatever
>>
Guys, you know how vim has no words being split in the margin.
How would you, given a integer width, change a string such that it has no words in the margins.
Keep in mind newlines.
>>
File: 1350594293765.jpg (111KB, 500x500px) Image search: [Google]
1350594293765.jpg
111KB, 500x500px
How do I get a cross-platform time difference in microseconds in C++?
>>
>>60820815
it changes rapidly because none of the web "technologies" are good enough to become the de facto standard
>>
>>60820829
http://rextester.com/PELQ26037
>>
>>60820829
std::experemental::boost::platform_independent_timeDifference
>>
>>60820800
I just entered the thread so I don't know if there's context to this so I'm just going to respond to this post taken on its own.

Yes, it's true that you can't say you've really gotten proficient at programming until you know a languages nooks and crannies and peculiarities off the top of your head and rarely have to consult the documentation for even moderately complex problems.

But it's also true that such skill requires a lot of time to hone, and in that time things could (and probably will) change drastically in a world that progresses as fast as technology. Not only that, sometimes you may need to switch jobs out of necessity. At that point you may need to pick up another language, a process made a lot easier if you've already experimented with it in your spare time.
While you absolutely do need to know the basic core of programming by heart (assignment of variables, calling of functions, scope, etc. None of these things or similar things should ever confuse you) knowing only one language really, really well might end up not working in your favor in the long run.
>>
File: brazil not even once.jpg (46KB, 700x525px) Image search: [Google]
brazil not even once.jpg
46KB, 700x525px
>O(n^4) parsing
>>
File: 1487635539415.png (40KB, 1620x774px) Image search: [Google]
1487635539415.png
40KB, 1620x774px
>>60820864
>Undecidable parsing
>>
>>60820843
that's fair. yesterday there was an anon who said it was easier to remember "righty tighty, lefty loosey" than to just "know" which direction you should turn a screw to tighten it, and anons were defending the use of mnemonics past the learning stage. i just think that turning a screw is something so basic that an adult of average intelligence shouldn't struggle with it or find it useful to memorize a mnemonic for it.
>>
>>60820878
Anyone else think Bjarne is an idiot with an inflated ego?
>>
>>60820897
s/bjarne/guido
>>
>>60820897
I don't think he has an inflated ego anymore it's just that people praise his language to high heavens when it's not worth it.
>>
>>60820897
When has he ever shown an ego?
All the things ive watched him in it just seems like he's horribly depressed
[[Stale Sepples joke]
>>
>>60820727
Anyone have any guides for programming on TempleOS?
>>60820829
Chrono.
>>
How do you manage configuration files?
How do you manage multiple servers that all need updating at the same time?
What software do you use to monitor uptime and failures?
>>
File: 5.jpg (10KB, 300x100px) Image search: [Google]
5.jpg
10KB, 300x100px
Working on my imageboard, 4kev.org
>>
>>60820829
http://en.cppreference.com/w/cpp/chrono/duration
>>
>>60821033
>If your colorscheme has any pure colors in it, then say goodbye to your eyesight.
https://ux.stackexchange.com/questions/53264/dark-or-white-color-theme-is-better-for-the-eyes
>>
>>60821090
Yes weve all seen that stack link.
That doesnt refute what i said though.
Dont use pure colors, they are bad, especially white and black.
use saturated colors.
>>
>>60820788
Well, if they use this they are one.
>>
>>60821117
Prove it
>>
File: Yakumo.Ran.full.1823527.jpg (642KB, 775x1100px) Image search: [Google]
Yakumo.Ran.full.1823527.jpg
642KB, 775x1100px
>>60820800
>you'll suck at problem solving etc if you're unable to reason with things intuitively
But we use words to reason, even in our thoughts. Or do you deal with problems so trivial that words are seldom used?
>>
How do you do useful things with C++?
>>
>>60821090
>As this article on UXMovement states, "white stimulates all three types of color sensitive visual receptors in the human eye in nearly equal amounts." It causes the eye to focus by tightening the iris. Since the eye is focused, dark letter forms on light backgrounds are easier to read.
this argument is nullified when you have thin grey text such as on stackoverflow which is more difficult to read in the name of being less "harsh"
>>
>>60821149
its literally day 0 shit in color theory.
Its harsh on the eyes.
White and black especially cause fatigue faster.
>>
>>60821159
>But we use words to reason, even in our thoughts.
if you're not retarded you can reason on an "abstract" level and visually as well
>>
File: Yakumo.Ran.full.2040274.jpg (483KB, 700x980px) Image search: [Google]
Yakumo.Ran.full.2040274.jpg
483KB, 700x980px
>>60821168
If you're too lazy to learn Fortran C++ is good for things that requires high performance.
>>60821185
Words are used to describe abstract concepts, champ, and unless you're some kind of braindead codemonkey where you don't deal with lots of different abstract concepts everyday you're gonna need them to label those concepts.
Read Tractatus sometime, boy.
>>
So /dpt/, what are some new languages BESIDES rust,go,kotlin,d you think have a chance of being good?
>>
File: 1494245067733.jpg (54KB, 240x430px) Image search: [Google]
1494245067733.jpg
54KB, 240x430px
>>60821239
>D
>chance of being good
>>
>>60821225
words are used for communication, but not necessarily for thinking and doing tings

kill yourself lmfao jackass
>>
>>60821225
fortran doesn't have better performance than C++ with modern compilers dumbshit
>>
File: smug_ran4.jpg (465KB, 565x800px) Image search: [Google]
smug_ran4.jpg
465KB, 565x800px
>>60821273
>not necessarily for thinking and doing tings
Yeah not necessary at your level it seems.
>>60821280
Wrong.
>>
>>60821290
ahahahahahhahaha have a (You)
>>
is that why some people are so fucking slow at drawing obvious conclusions, because they're having an internal monologue about every single thing they're thinking about
>>
>>60821168
learn GUI or graphics library then write an application using it
>>
File: light_kek.jpg (31KB, 364x275px) Image search: [Google]
light_kek.jpg
31KB, 364x275px
>>60821311
Did your brain stop working anon? Should probably use some words next time.
>>
>>60821350
stay delusional dumb cunt
>>
>>60821336
>>60821354
Oh the Dunning-Kruger is strong in this one.
>>
>>60821258
>>
>>60821356
KILL YOURSELF, you're absolutely pathetic, even if you're just trolling you're a pathetic time waster
>>
>>60821356
>Dunning-Kruger
It's funny how, the people who mention this are usually also under the same effect
>>
>>60821387
>>60821389
>this samefagging
>autism overload
>>
if someone throws a rock at you you don't need to talk to yourself in your head to know to get out of the way of the rock

if you're solving a jigsaw puzzle you don't need to use words to get pieces to fit together

if you're solving a math problem you don't need to say in your head "two plus two" to know that 2+2=4
>>
>>60821400
>>this samefagging
How very interesting
>>autism overload
You are the one acting like an autist desu
>>
>>60821428
>these are the kinds of problems he's dealing with
LMFAO holy shit
>>
>>60821442
they're just dumbed down examples so everyone including (You) can understand
>>
>its a phoneposter shitposting episode

Getting tired of this re-run desu
>>
>>60821453
Sure it is brainlet LMAO
>>
>>60821465
yeah i'm the one suffering from the dunning-kruger effect
>>
File: tmp_4573-70e-1473377366.jpg (28KB, 567x565px) Image search: [Google]
tmp_4573-70e-1473377366.jpg
28KB, 567x565px
>>60821442
>>
>>60821471
Yes actually.
>you should never use words to think
Jesus fucking Christ lfmao
>>
>>60821482
who are you quoting?
>>
What the fuck are you even arguing about?
>>
>>60821488
You.
>>
>>60821490
apparently this sperglord literally spells out in his head "righty tighty, lefty loosey" every time to figure out how he should open a plastic bottle
>>
Why is there such a high prevalence of autism within anime posters?
>>
>>60821575
don't pretend you're not autistic, everyone here is
>>
@6..5
anti-anime posters are infinitely more autistic
>ree this picture has things i dont like in it, better derail a thread over it
>>
>>60821593
i think some are just gay
>>
Be honest, do you LIKE programming?
>>
>>60821616
What? Don't you?
>>
>>60821225
>If you're too lazy to learn Fortran
You're Fortranu a shit
>>
>>60821619
I don't know if I do.
What do people like about it?
>>
>>60821616
i don't like getting stuck trying to fix a bug or implementing a big feature which takes a lot of time and effort, but i enjoy making progress and i definitely like building software, and i like the fact that it's challenging and i like having an edge in that not everyone can program with the same proficiency as me
>>
>>60821642
Programming is an exercise in advanced problem solving.
Also occasionally, you write some shit that is useful.
>>
>>60821488
>it are le stanky whomst art thou quoting maymay
>>
>>60821650
>Programming is an exercise in advanced problem solving.
t. never had a job
>>
>>60821646
Would you do it for your entire life?
>>
>>60821661
programming != being a code monkey
>>
>>60821605
you're moving the goalpost now

just admit you got btfo by japanese lolis
>>
>>60821159
>we use words to reason, even in our thoughts.
No we don't. We use words to communicate reasoning. It doesn't always work.
>>
>>60821663
i would probably move on to mainly the business management or software architecture side of things like managing a team of programmers but i think i'll be interested in programming for a long time
>>
>>60821684
How do you know you're not just a code monkey who was just technologically literate.
>>
>>60821350
What you're saying is patently untrue. "Language is required for thought" is one of the most imbecilic beliefs ever.
>>
>>60821575
I'm not, or at least I dont sperg out over meaningles things.

>>60821604
I dont catr about the pictures desu. It's just whenever I encounter someone especialy dense, it's usually someone who argues with smug anime girls
>>
>>60821672
No actually that's exactly what programming is and it's literally nothing else ever. You just implement the same standards over and over again day after day, dictated to you by people who don't know what they're talking about because they don't program. It doesn't get better one day, that's all it is all the way up. The only way to get a "better" / more fulfilling programming job is to be an independent software entrepreneur, and at that point, let's just be fucking fair, you don't REALLY have a job, you're just an autist.
>>
>>60821716
That guy is a known autist. He shitposts several generals on 4chan with his retarded crap.
>>
>>60821728
Prove it.
>>
#6..6
Posting smug has become a tactic in itself though.
You can usually tell whos genuine by the filename, and who just saves artifacted smug with a 4ch filename.
>>
>>60821716
>It's just whenever I encounter someone especialy dense, it's usually someone who argues with smug anime girls
Do you literally never leave this site?
Because there are plenty of especially dense people who don't argue with smug anime girls, and most of them don't come around these parts.
>>
>>60821701
Prove it.
>>
>>60821749
Non-human animals:
- capable of thought
- incapable of language
>>
>>60821769
I'm pretty sure he was talking about the kind of thought for which human intelligence is required.
>>
>>60821749
Deaf people.
>>
>>60821794
>human intelligence
How does that differ from general intelligence?
>>
>>60821794
He's wrong regardless of what he meant. Another example are visual proofs in geometry. Do you verbalise internally when you draw graphs? I don't. Actually, I don't verbalise most of my thoughts. They just 'pop-up' in my head.
Another example: people do worse at a task when they're asked to verbalise what they're doing.
>>
>>60821794
https://anthonybonato.com/2016/04/20/this-is-your-brain-on-mathematics/
>A fascinating recent study by French neurobiologists Marie Amalric and Stanislas Dehaene reached an interesting conclusion: mathematical thinking, whether basic or advanced, resides in a nonlinguistic part of the brain. Our brains process language and mathematics differently.
>>
>>60821830
Can you predict mathematical ability by the surface area or mass of that part of the brain?
>>
File: pattern matching.png (13KB, 518x353px) Image search: [Google]
pattern matching.png
13KB, 518x353px
Pic related is generated by an algorithm. When asked to deduce pattern and complete the picture, most people will not verbalise their search, and when asked to verbalise what they're trying to do to get the solution, they will do significantly worse (take a whole lot longer to find the solution).

Try it. Do you talk to yourself in your head while you think about how to complete the picture?
>>
>>60821878
Also, you are not allowed to use pen and paper to solve the problem, or any other aides. The whole task must be done mentally.

(A fair warning: 99% of people are neurologically incapable of finding the pattern in that picture.)
>>
>>60821878
damn son that's a tough one

they should put more challenging patterns like that on intelligence tests
>>
>>60821878
>Try it. Do you talk to yourself in your head while you think about how to complete the picture?
Yes. I'm thinking what fucking pattern.
>>
>>60821878
I'm wary of this image is just trying to waste your time, and there is no actual pattern.
>>
>>60821942
It's from a Danish online IQ test
>>
>>60821942
yeah there are 3 of each symbol in every grid but other than that they just look scrambled

>>60821948
which site?
>>
>>60821824
>Another example are visual proofs in geometry.
I don't believe those.
>>
>>60821923
>>60821942
I already solved it. Every block is generated from the previous one using 3 transformations. It is one of the hard problems used in Raven's progressive matrices IQ tests. If you can solve it as indicated you have an IQ of 140 (plus or minus 5 IQ points). I specifically picked a hard problem because if the problem is hard you actually have to think to find the pattern.
>>
>>60821966
In case you gave up, here are the rules (warning -- reading this invalidates the test for you): the shapes change one into the other on cyclic basis. Columns shift. The whole block is rotated.
I'll let you figure out the details yourself.
>>
Friendly reminder that modern C++ {11,14,17} is GOAT

#include <type_traits>
#include <iostream>


// List nodes have a value member and a next pointer
template <typename Object, bool is_class = std::is_class<Object>::value> // only classes have members
struct is_list
{
template <typename T, T Object::*>
struct helper;

template <typename T, typename U>
static std::false_type has_next(...);

template <typename T>
static std::false_type has_value(...);

template <typename T, typename U>
static std::true_type has_next(helper<U, &T::next> *);

template <typename T>
static std::true_type has_value(helper<decltype(T::value), &T::value> *);

typedef decltype(has_next<Object, Object*>(nullptr)) next_tester;
typedef decltype(has_next<Object, const Object*>(nullptr)) const_next_tester;
typedef decltype(has_value<Object>(nullptr)) value_tester;

static const bool value = (next_tester::value || const_next_tester::value) && value_tester::value;
};

template <typename Object>
struct is_list<Object, false> : std::false_type {};


// Because sepples doesn't allow partial function specialization
template <typename List>
typename std::enable_if<is_list<List>::value, void>::type print_list(const List& list)
{
for (const auto* ptr = &list; ptr != nullptr; ptr = ptr->next)
{
std::cout << ptr->value << std::endl;
}
}

void print_list(...)
{
std::cout << "Not a list" << std::endl;
}


int main()
{

struct List
{
int value;
List* next;
};

struct NotAList
{
int value;
List* next; // next pointer is not of same type
};

List head = { .value = 17, .next = nullptr };
print_list(head);

NotAList list = { .value = 11, .next = nullptr };
print_list(list);

print_list(14);

return 0;
}
>>
>>60822031
http://www.codersnotes.com/notes/cpp-rant-2/
>>
>>60822039
Thanks for the link, yeah, I do agree that the committee is a bit backwards.

Still, C++ has come a long way from the broken POS it used to be.
>>
>>60822031
this

>C++
https://www.youtube.com/watch?v=rWDNwN0h0LM

>python
https://www.youtube.com/watch?v=rkcXRBhYZHU


>C++
https://www.youtube.com/watch?v=MZIv6WtSF9I

>python
https://www.youtube.com/watch?v=qFl-Q21MzmQ


>C++
https://www.youtube.com/watch?v=1CpjRMICXNM

>python
https://www.youtube.com/watch?v=IIAWs3_Hgtc
>>
File: 1423103044879.png (46KB, 184x184px) Image search: [Google]
1423103044879.png
46KB, 184x184px
>>60820727
I started C++ yesterday with only basic knowledge of Java and lua and I'm currently trying to wrap my head around the FindFirstFile function. Why the fuck is it in all caps goddamn and I don't know how to implement it in my current code. I'm trying to make a program that simply counts how many mp3 files the user has after entering a filepath.
>>
>>60822122
>FindFirstFile function. Why the fuck is it in all caps goddamn
Because that's a windows specific thing. C++ doesn't have native filesystem support yet. You can use boost for that if you want to write platform agnostic filesystem code.
>>
>>60822171
http://en.cppreference.com/w/cpp/filesystem has been merged into C++17 tho
>>
>>60821878
My bet would be.
vxo
xox
ovv
(v is the triangle)
>>
looking at C++ and rust code makes me feel ill.
>>
>>60822236
looking at "codes" in general makes me feel ill.
>>
>>60822236
found a ninja code artisan rockstar
>>
>>60820806
"Haskell" isn't just a type-checker though.
>>
>>60822302
But im currently learning Agda.
>>
To the educated and uneducated:
http://gartner.mediasite.com/mediasite/play/9cfe6bba5c7941e09bee95eb63f769421d
24 minutes and 30 seconds in.
Watch a minute.
Have an opinion.
>>
>>60821575
I'm diagnosed autistic but I rarely ever get called autistic. When I do it's usually someone who says it in the sense of 'you know too much'.
>>
File: 1493970253162.png (372KB, 865x705px) Image search: [Google]
1493970253162.png
372KB, 865x705px
>>60822320
It has I/O though.
>>
>>60822340
I'd like to I O her if you know what I mean.
>>
>>60822321
>10/19/2011
wtf? besides the online teaching everything looks so out of date like it's from the 80s
>>
60822340
(You)
>>
>>60822369
Well basically this guy
https://en.m.wikipedia.org/wiki/Clayton_M._Christensen
Fucked your degree in 2011 and you still haven't left it behind.

I see people arguing all the time about how degrees are important. It's all horseshit. Be ahead of the curve for once.
>>
>>60822430
Is mold growing on his head?
>>
>>60822430
>.m
Fucking cancer.
>>
>>60820796
With SKI-combinators?
>>
>>60822031
>template <typename Object, bool is_class = std::is_class<Object>::value> // only classes have members
V O M I T . J P G
>>
>>60822707
Still better than fucking Rust syntax.
>>
>>60822748
Are you fucking serious? I know Rust's is bad, but Sepples is in it's own tier of shittiness.
>>
>>60822768
>Are you fucking serious?
Yes I am fucking serious.

>know Rust's is bad, but Sepples is in it's own tier of shittiness.
That line makes total sense, the tricky one is the enable_if one ffs. If you can't even read the first line, you are just programming illiterate tbqh
>>
>>60822039
>C99 designated initializes
I had no idea that was a thing. I really need to read this stuff more.
>>
>>60822783
You should check out C11 then, with anonymous structs C99 initialisers are the only way of initialising those.
>>
>>60822806
>C99 initialisers are the only way of initialising those
No they're not. You can initialise them normally too.
Still, designated initialisers are an incredibly useful feature, and the stupid sepplesfags will never know how great they are.
>>
>>60822828
>No they're not. You can initialise them normally too.
Initialise this

struct some_struct {
int test;
struct {
int test;
};
};

void foo()
{
struct some_struct;
some_struct.test = 2; // which test?
}
>>
>>60822859
That's invalid code.
You can't have an anonymous struct member with the same name as an enclosing struct member.
>>
>>60822430
joke's on you i don't have a degree
>>
>use a language with actual good constructor semantics
>dont have to fix problems from the 90s
>>
can anyone give me some tips for my homepage
https://cs.stanford.edu/~knuth/experiments.html
>>
>>60822935
needs some rare pepes
>>
>>60822935
Jesus christ, Knuth. That's worse than Stallman's page.
If all of the styling was removed, it probably wouldn't be that bad.
>>
>>60822959
>pepes
>>>/v/
>>
>>60822929
go on ...
>>
>>60822935
Absolutely autistic
>>
>>60822565
If you run it through a lambda calculus -> SKI compiler.
>>
>>60822982
Nice meme.
>>
>>60822982
why do you exist?
>>
>>60823007
All of the best computer scientists are.
>>
>>60823009
>meme
>>60822982
>>
>>60822783
>designated initializes
kek is that a big thing for you? Sad.
>>
>>60823026
>>60823009
>>
I want to make a tower defense.
>>
So I just found out that arrays in javascript are actually hash tables. So... there are no actual arrays in this language.
What the fucking fuck?
>>
>>60823114
then make it.
>>
>>60823114
Who's attacking your tower, m8?
>>
>>60823342
For very high level scripting languages, that's actually not uncommon.
Lua does that too.
>>
>>60823342
FooNaN
>>
>>60823114
do it 9/11 style
>>
>>60823358
Yeah but for what purpose? Not all abstraction layers are useful.

You know what would be great? A "multi-level" scripting language that's only ever as high level as it needs to be to avoid compromising usability.
>>
>>60823358
>very high level scripting languages
aka shitlangs
>>
>>60823838
I don't really know much about the webmeme script, but in Lua, you can use any arbitrary value (except nil) to index a table. You can emulate arrays by just indexing with numbers. It's more consistent to have a single compound data type instead of treating arrays differently.
>>
>tfw your language can be used for scripts if needed,but doesnt lack any basic features
dont know why people still use memelangs desu
>>
>>60823885
>tfw your language cannot be run natively in any reasonably widely used browser
>tfw you are literally such an angry tunnel visioned brainlet that you think this is okay because web programming is a meme
>tfw you still have yet to accept the admittedly ugly reality that web programming is hands down the most important and prolific kind of programming in the world
:^)
>>
>>60823871
>meme
>>>/v/
>>60823920
>:^)
>>>/v/
>>
>>60823920
>cannot be run natively in any reasonably widely used browser
but thats false
i can even use it for webshit if i have to
>>
File: eggy.jpg (59KB, 500x526px) Image search: [Google]
eggy.jpg
59KB, 500x526px
>>60823938
> >>>/
>>>/trash/
>>
>>60823945
oh okay i get it
what you're telling me is that your language is either java, javascript, or flash
>>
>>60823963
nope
shared static this()
{
auto settings = new HTTPServerSettings;
settings.port = 8080;

listenHTTP(settings, &handleRequest);
}

void handleRequest(HTTPServerRequest req,
HTTPServerResponse res)
{
if (req.path == "/")
res.writeBody("Hello, World!", "text/plain");
}
>>
>>60823920
>tfw my language compiles to javascript
>>
>>60823885
>meme
>>>/v/
>>60823949
>eggy.jpg
>>>/b/
>>
>>60823970
you run a server in your browser? fascinating
>>
>>60823970
That's not web programming, that's server programming. You CAN use it for client-side shit, and handle i/o to your script with ajax, but that would be a very slow script. So I stand my ground:
>tfw your language cannot be run natively in any reasonably widely used browser
>>
File: a90.png (24KB, 200x200px) Image search: [Google]
a90.png
24KB, 200x200px
>>60823988
> >>>/
> >>>/
>>>/trash/
>>
>>60823920
>tfw your language cannot be run natively in any reasonably widely used browser
but it can now senpai

t. c programmer
>>
File: 1439955449398.jpg (539KB, 1200x1192px) Image search: [Google]
1439955449398.jpg
539KB, 1200x1192px
>>60820727
How can I prevent my language from being used for any kind of web """dev"""? Ideally it should be able to detect that it's being compiled to something used for web """dev""".
>>
>>60824060
impossible, that would be like having English """detect""" when its being translated into Dutch
languages dont have cpus
>>
>>60824060
>my language
Just keep it imaginary.
>>
>>60823997
nah, theres diet templates for basic HTMS shit
>>
>>60824060
When will this "web is evil" meme end?
>inb4 >>>/v/
>>
>>60824111
Actually it's >>>/g/wdg/ .
>>
File: q.jpg (30KB, 480x270px) Image search: [Google]
q.jpg
30KB, 480x270px
>>60824060
>being this much of an angry tunnel visioned brainlet
But senpai, don't you know that web programming is currently the most important and prolific kind of programming in the world?
Don't get mad, don't shoot the messenger. I didn't ask for this either.
>>
>>60823342
What's wrong with that tho? You can just wrap it in an iterator if you like that style of accessing better.
I don't really see how JS's arrays are much different than any other.
>>
File: rust.png (231KB, 755x428px) Image search: [Google]
rust.png
231KB, 755x428px
Why is Rust so ugly?
>>
>>60824122
Do you guys remember the old /g/?
You know.. back when every other post wasn't
> >>>/
>>
>>60824087
>impossible, that would be like having English """detect""" when its being translated into Dutch
That's only the second part of my question though.
>>60824099
What are you trying to imply here?

>>60824111
I didn't claim it was "evil". I just don't want my language having anything to do with that piece of trash.

>>60824125
>don't you know that web programming is currently the most important and prolific kind of programming in the world?
The supposed truth of this statement is irrelevant to my question though.
>I didn't ask for this either.
You choose to participate in it.
>>
>>60824158
>literally the most conservative syntax out there
>anyone can read it
>ugly
I mean, you could at least have posted ::<<><>> and likes.
>>
>>60824168
>>>/trash/
>>
>>60824168
heres your regex test
successfully filter gate-keeper
>>
>>60824187
>>>/edgy/
>>
>>60824158
>
.all(|c| c.iswhitespace())
.map(|path| Image::load(path))

please tell me the author was just being explicit with his lambdas for whatever reason and Rust allows you to write
.all(iswhitespace)
.map(Image::load)
>>
>>60824184
Literally the most basic things are filled to the brim with tedium.
>>60824212
heres the talk if you're interested
https://www.youtube.com/watch?v=lO1z-7cuRYI
>>
>>60824207
Your posts are off-topic, hence why you were redirected to >>>/trash/. Please talk about programming.
>>
>>60824212
It does, it has UFCS so abc.def(1, 2) is the same as ABC::def(&abc, 1, 2).
>>
>>60824158
Because they tried to graft high-level functional ML semantics onto C syntax which wasn't intended for it and ended up with a shitpile of punctuation and brackets as a result.
>>
>>60824155
>I don't really see how JS's arrays are much different than any other.
In a reasonable language, array is a memory buffer indexed serially by address distance.
A hash table, then, would be an abstraction layer that stores its values decorated with keys, and computes the index to store under based on fairly uniformly distributed functions of those keys.
The monstrosity you see in languages like javascript and lua is another abstraction layer over that abstraction layer that provides special case operations for when the keys can be restricted to plain numbers.
These special case operations would have been somewhat more efficient and easier to implement if the designers of the language had simply omitted the abstraction layer of the key-value model in this special case and simply stored the data serially.

Before anyone complains, the reason I explained that so pedantically is because anyone who says "I don't really see how JS's arrays are much different than any other" would probably have no idea what I was talking about if I'd used more succinct vernacular.
>>
>>60824255
>functional
What is ``Functional" though?
>>
>>60823342
It gets better. Functions are also hash tables!
let f = function(x) { return x*x; }
f.foo = 42;
f( f['foo'] ); // 1764


I just love the future of JS
((__,_)=>(_*__))(6,9); // 54
>>
File: h5nyo9ne1.png (222KB, 997x1335px) Image search: [Google]
h5nyo9ne1.png
222KB, 997x1335px
>>60824255
>functional ML something
>not a shitpile of punctuation and brackets to begin with
You must be jesting.
>>
>>60824284
>((__,_)=>(_*__))
What did Javascript mean by this?
>>
>>60824308
First one looks like my butt
>>
>>60824305
>functional
What is a ``Functional" though??
>>
https://blog.tintagel.pl/2017/06/09/openbsd-daily.html
Have you read OpenBSD source today? If not, why? Don't you know you can become a better programmer by reading outdated source code of an outdated OS in an outdated programming language?
>>
>>60824308
its an anonmyous function that takes in two arguments, one named __ and one named _ and returns their product. then the function is evaluated with 6 and 9 as the arguments. Its a fine feature, for whatever reason the author decided to use obtuse argument names in an effort to obfuscate his code.

javascript is a terrible language for reasons completely unrelated to anonymous functions and you dont need to obfuscate your code to show that.
>>
>>60824284
To be fair, in any language where functions can be generated dynamically, they do require a hash table component to store captured bindings, or at least a plain array component if symbols can be stripped.
>>
>>60824308
Looks very progressive to me.
>>
>>60824346
>blog
Stopped reading right there.
Fuck off to >>>/g/wdg/
>>
>>60824308
It's two fat men bumping bellies.
>>
>>60824346
>outdated
>Netflix and many other huge corps use it regularly over ((((((GNU)))Linux)))
>>
>>60824341
>oh
>it
>are
>le
>stanky
>whomst
>art
>thou
>quoting
>maymay

>>>/b/
>>
>>60824197
ah, filtered
>>
>>60824284
So why are you stating the obvious?
Almost everything can be handled as if it was an object in JS, this is not news.
Besides, you used too many parenthesis there
((__,_)=>_*__)(6,9); // 54
>>
>>60824404
>apple uses it regularly over (((girl (((male))))))
>>
is nim a meme
>>
>>60824212
Yes, you could just write
.all(char::iswhitespace)
.map(Image::load)

It compiles to the same code anyway, as closures are inlined.
>>
>>60824427
>meme
>>>/r/abbit
>>
>>60824427
yes, use vano instead
>>
>>60824404
They use FreeBSD tho, mostly because of ZFS. No one is crazy enough to use OpenBSD in actual production, at least not in last 5-10 years. For some reason, I've seen some increase in posting about it recently, but it mostly some hipster for whom Linux is too mainstream now.
>>
>>60824427
Elm > Nim > ShitS
>>
>>60824427
memes are popular
>>
>>60824432
>It compiles to the same code anyway
I would hope so
>>
File: 17 - 1 (2).gif (505KB, 1080x1080px) Image search: [Google]
17 - 1 (2).gif
505KB, 1080x1080px
>>60824434
> >>
> >
> >>>/
>>>/trash/
>>
>>60824366
>being this triggered by a link
>>
>>60824438
>open
Oh right, i should probably read stuff for more than a quarter glance
>>
>>60824454
well to be fair if i were thinking like an sjw here it is a little triggering that he's a blonde blue eyed white male that kills an evil black ginger to rescue a blonde white princess
>>
what's a nice oop way to return multiple things if i dont want a wrapper class? object array fuckery isnt acceptable either
is using pairs/tuples the only way?
>>
>>60824506
>OOP way
>nice way
pick one
>>
>>60824506
You could use a wrapper struct instead. Then you don't have to write tedious things like a constructor.
>>
>>60824435
you seem to think it is an editor rather than a programming language

>>60824439
elm doesn't seem to be anywhere near the same thing unless you think 'anything that can compile to js is the same', which would include just about everything at this point because of emscripten and asm.js

>>60824442
i don't think nim is popular so that would mean no
>>
>>60824264
Yeah okay, but JavaScript is a veeeery felxible language. Anything can be interpreted in infinite ways, so instead of trying to do just that, focus on what parts you can interpret in a functional way that is of use to you.
Like shit nigga, it's like real life, you see a pen and you draw/write with it, not jam it in a 3.5 mm audio port. I mean that's one way to use a pen, but that's not functional.
>>
>>60824506
>>60824533
In fact, you could even use an anonymous unnamed wrapper struct. If it's the only time you'll ever use it, you can just write out the full definition of the struct in the method's return type:
struct { OneObjectType* a; AnotherType* b; } myMethod();
>>
>>60824506
Literally nothing wrong with using a wrapper class. /dpt/ is obsessed with one liners so they'll give you shit but its the best solution in the long run
Tuples are fine too
To go full meme, pass in a reference and set the reference in the function

void the-thing(constant int a, constant int b, int result1, int resut2) 
result1 = a * b'
result2 = a + b
>>
>>60824506
>object array fuckery isnt acceptable either
if your language makes working with object arrays, difficult, its time to switch
>>
>>60824553
Would you really use nim for non-webshit over the many other systems-specific languages?
>>
>>60824506
(values "foo"
:bar
123)
>>
>>60824561
downcasting is never acceptable
>>
For some reason, they've just added Haskell to Compiler Explorer: https://haskell.godbolt.org/ .
Because obviously, the quality of the resulting assembly is very important for Haskell programmers.
>>
>>60824561
by that i meant
int firstResultIndex=0;
int secondResultIndex=1;
...

Object[] results = new Object[resultCount];
results[firstResultIndex]=foo;
...


>>60824533
>>60824555
it's java so not really an option

>>60824557
in my opinion wrapper classes are a terrible solution for the problem and decrease readability, so that's why i said i dont want them

tuples it is i guess
>>
>>60824588
>You cant do object arrays without POO
>>
>>60824582
oh a tuple nice well done op didnt suggest that in the original post so creative
>>
>>60824605
>in my opinion wrapper classes are a terrible solution for the problem and decrease readability
i disagree
>>
>>60824609
this isn't a tuple you mong
>>
>>60824628
oh god so sorry its a list right gosh sorry i forgot lisp only has one data type my bad
>>
>>60824646
0 for 2 try again champ
>>
>>60824579
Last time I used rust I got really mad at having to .unwrap things or make long chains with dumb anonymous functions over and over. Then, when I was done and tried to ship it as a single binary I couldn't because there was no way to get rid of the dependence on libgcc_s_dw2-1 that I had to ship with it.
>>
>>60824626
>Pair<String,Integer>
vs
>StringIntegerWrapper
or
>ObscureSeldomUsedMethodReturnWrapper

i'd take the pair any day
>>
>>60824605
>C# unironically cant do something as simple as appending
>instead you need to make a whole new type to ducktape with
wew
>>
>>60824674
i said im using java but nice meme friend
>>
>>60824554
>Like shit nigga, it's like real life, you see a pen and you draw/write with it, not jam it in a 3.5 mm audio port
My point exactly. So by the very metaphor you propose, why does javascript do just that -- jam a pen into a 3.5mm audio port -- instead of just providing both a pen and a 3.5mm audio jack?
>>
>>60824682
well they both use the same List<> shit
>>
>>60824673
I find that if a method returns two values, pretty soon it will want to return three. When you add a value to a class, client code does not need to make any changes. When you add a value to a tuple, clients will break and will need to be rewritten.
>>
>>60824673
You are aware that Pair is just a wrapper class defined by the standard library?
>>
>>60824735
but pairs atleast use generics
>>
Is there language with same semantics as C but with smarter compiler?
Like having type inference and better macro system than preprocessor macros.

ATS seemed promising but the syntax is fucking ugly.
>>
>>60824752
So?
The fact that they use generics makes their type be tied to number of values so you can't extend it to three or more later on as >>60824725 said.
>>
>>60824772
Just write your own.
>>
>>60824725
And I've never had a function that needed to return two values that I was 100% sure would only ever return need to return two values.

>>60824557
For example, the function I wrote here really should be two separate functions, add() and multiply() I'm curious of your use case.
>>
>>60824772
The only good macros are lisp macros.
>>
>>60824788
no.
>>
>>60824772

C++.
>>
>>60824790
you're right
i should just split them
i dont know why until now i hellbent on having it returned at the same time
>>
>>60824805
ok.
>>
>>60824809
>name mangling
>no standard ABI
I don't think you can even count sepples as language because it's so shit.
>>
Lisp friends, give me a macro i cant accomplish with a simple template.
>>
friendly reminder that in C
foo[10]

and
10[foo]

are equivalent
>>
>>60824692
But how does that change the rational usage of a pen?
var array = ["Hi", "I", "am", "an", "array", "!"],
i = 0;
for ( ; i < array.length; ++i ) {
console.log(array[i]);
}

How does behaviour here differ in any way compared to other languages?
Before you go on saying how terrible it is that JSArray is actually a hashtable, then please show me an example that makes implementing your feature difficult, quirky, not reasonable.
>>
Good morning /dpt/!
>>
>>60824841
ok
>>
>>60824830
Any read macro.
>>
>>60824783
No they aren't.
foo[10]: Navigates to memory position 10*sizeof(*foo) bytes away from the address foo and does a read of sizeof(*foo) contiguous bytes.
10[foo]: (hypothetically) Navigates to memory position ((intptr_t) foo)*sizeof(*10) bytes away from address 10 and does a read of sizeof(*10) contiguous bytes. This behavior is ill defined because 10 is an int and no information is available on what kind of pointer it should be if it should be implicitly interpreted as a pointer.
>>
>>60824841
see: >>60824890
>>
>>60824890
arr[i] = *(arr + i) = *(i + arr) = i[arr]
>>
>>60824890
>>60824901
>>60824906

Proof: https://ideone.com/iQ2Ep3
>>
>>60824906
>*(i + arr) = i[arr]
Wrong. i is the pointer here and arr is the offset. i[arr] is not *(i + arr), because when you add an integer to a pointer, the result is the same kind of pointer, but when you implicitly cast an integer to an indeterminate kind of pointer and then add another pointer to it (which is what i[arr] does), the other pointer is implicitly cast to a plain integer type, and the result is therefore of the same type as the lefthand pointer.
>>
>>60824966
I literally showed that this works >>60824940
>>
>>60824940
Doesn't work if you change it to an array of longs
>>
>>60824966
>talking shit like he knows what he's talking about even though he has no idea
>>
>>60824990
>>60825009
see: >>60825001
>>
>>60824851
Should be
for (String s : array)
vonsole.log(s);
>>
>>60825031
>types
no
>>
>>60820815
Ruby on Rails, Python (Django/Flask), Node.js
There's also been an influx of stuff written in Go but I don't think there's nearly enough of those to compete with the first three.
Do your own research faggot.
>>
>>60825001
Ctards blown the fuck out
>>
>>60825031
>semantics
for (let s of ["Hi", "I", "am", "an", "array", "!"])
console.log(s)

That still makes you a whiny bitch for not providing any argument so far to go with your complaint.
>>
>>60825073
>moving the goalpost
You have already been proven wrong dumb cunt.
>>
>>60825102
>>moving the goalpost
"Doesn't work if you change it to an array of longs" is not moving the goalpost.

You initially claimed it works. This claim was not qualified with an indication of arr's exact type. We could infer from the syntax that it was a pointer or an array, but that was all. And it just so happens, that unless it's specifically an array of ints, 10[arr] is not equivalent to arr[10].
>>
>>60825102
what goalpost? i'm saying they're not equivalent
>>
>>60824825

It's literally what you asked for.
>>
>>60825100
crikey mate what has ravaged your anal cavity today?
>>
>>60825001
>>60825121
>Doesn't work with array of longs
Get fucked: https://ideone.com/PMHruj
>>
File: Capture.png (51KB, 657x154px) Image search: [Google]
Capture.png
51KB, 657x154px
>all that nonsense just to pass a vector
>>
>>60825161
They're implementing the language wrong. Of course it would work with ints, because if something needs to be treated as a pointer with no indication as to what kind, it seems reasonable for it to be an int*. But if it also works with longs, they're doing something wrong. Probably implementing i[arr] as *(i + arr), as you suggest. How naive.
>>
>>60825185
why do people even use all these shitty irrelevant fucking meme langs
>>
>>60825185
It's to demonstrate lifetime syntax, in most cases you don't need to declare a lifetime parameter. That example also can be written like this:
fn first(v: &Vec<String>) -> &String {
&v[0]
}
>>
>>60825208
Because being just SJW doesn't make special enough.
>>
>>60825202
since when is a + b treated differently than b + a
>>
i have an Example() class in java and i want a method inside it that will set something to all instances
how do i write it?

private void myMethod(Example e1){
e1.setSomething("kek") = 150;
}
>>
>>60825215
i don't want to read "eff enn" all the time

even this would be better:

\ first(v: &Vec<String>) -> &String {
return &v[0];
}
>>
>>60825215
Rust can do this though right?
string str "butts";
char c = str[0];
>>
>>60825253

You're probably writing your code wrong if you want to set an instance variable in all of that class's objects.
Try to set a single static variable instead.
>>
>>60825253
Use a class variable. You can't enumerate all instances to mutate an instance variable on each afaik, but you can make them share the same variable.
>>
>>60825237
a[b] is only a + b if a is a pointer though
otherwise it's (int*)a + b
>>
>>60825273
>You're probably writing your code wrong if you want to set an instance variable in all of that class's objects.
What about SQL though
>>
>>60825266
That's not rust code, so the question is meaningless. It's perfectly possible to achieve the same effect in rust though.
>>
>>60825308

I'm gonna need more context to fully understand what you mean.
>>
>>60825303
http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1256.pdf
>The definition of the subscript operator []
is that E1[E2] is identical to (*((E1)+(E2))).
>>
>>60825316
Do the same in rust then, im curious.
>>
>>60825308
This aint a database you moron, it's not meant to do that. Same concept confusion bs than >>60825266
>>
>>60825334
Do what? What does this code do? You havent specified a language to interpret it and you visibly typoed it anyway, which is excusable since you are a moron.
>>
>>60825359
declare a char from the first element in a string, stop pretending to be dense.
>>
>>60825359
LOL Rust cant't even access the first character of the string. SAD!
>>
>>60825316
>>60825334
You can't index rust strings directly
https://doc.rust-lang.org/std/string/struct.String.html#utf-8
>note: the type `std::string::String` cannot be indexed by `{integer}`
>note: the type `str` cannot be indexed by `{integer}`

You have to get an iterator over the chars (or if you want, bytes)
https://play.rust-lang.org/?gist=3780ca449a42e3be2df17341b2a080e9&version=stable&backtrace=0

Yes, its fucking idiotic
>>
>>60825416

fucking lol
>>
can someone provide a decent source to learn functional programming?
>>
new thread
>>0825429
>>
>>60825416
>
let s = String::from("Hello World");
let c = s.chars().next().unwrap();
println!("{}", c);


wow, people unironically use this language.
>>
>>60825429
new thread
>>
>>60825431
Developing application with OCaml
>>
>>60825445
not only do they use it, they unironically think it will make C++ obsolete
>>
>>60825483

unfortunately it seems like nothing will make C++ obsolete
>>
>>60825341
>This aint a database you moron,
WROG
Sql ids ofject orbientaled!!
PROOBF:
>values = cells
>instance variables = columns
>objects = rows
>classes = tables
>namespaces = databases
>functions = stored procedures
>methods = stored procedures whose names are stored in a method table also indexed by table names
>inheritance = foreign key
>upcast = left join
>downcast = full outer join
>>
>>60825532
No it's FP.
>>
>>60825532
sql is set theory friend.
queries operate on sets of rows and return sets of rows
>>
>>60825574
then OOP is set theory
because SQL is OOP
>>
>>60825642
ok lad
>>
>>60825642
No.
Thread posts: 331
Thread images: 30


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