[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: 37
Den gamle tråden: >>59299373

Velkommen til den daglige programmering tråden.

Hva jobber du med, /g/?
>>
>>54531622
Jeg kan ikke svare på, men jeg liker den norske
>>
>>54531622
Das ist jetzt ein deutscher Faden
>>
>>54531622
>using constructs abstracted from machine code
>using things like loops instead of jmps
kys
>>
>>54531671
>using fucking cancerous python
>using one of the worst languages in existence, only slightly better than THE worst language (php) for web faggotry
>>
>>54531694
I don't tho, I'm more C or C++
>>
>>54531720
>Which is more correct?
The one which returns the right results given the given problem
>>
>>54531622
Faen. Jeg vet ikke hvorfor nummeret er feil.
>>
>>54531720
depends on the circumstance idiot
>>
>>54531720

Neither.
>>
>>54531720
I feel like no one understood what I was asking for there.
>>
>>54531694
I don't tho. I use C and Scheme.
>>
>>54531743
were you asking if the second snippet was equivalent to the first one? then no
>>
>>54531720
I hope you have a return statement for if the result is negative
>>
>>54531720
The first one is using 6-space indents, automatic disqualification.
>>
>>54531654
今では日本のスレッドです
>>
>>54531768
It's just a snippet man. There's more code after it. So which one is better?
>>
>>54531762
I am >>54531599
>>
>>54531743
Kan du skrive det på norsk? Jeg forstår ikke engelsk.
>>
File: 48505648495150525150.jpg (65 KB, 1385x1077) Image search: [Google]
48505648495150525150.jpg
65 KB, 1385x1077
>>54531803
no
>>
>>54531793
in that particular example i would write:
>>54531617
>>54531666

in some situations i might write something like the below, without any else

if(result) {
return 0;
}

return 1;
>>
>>54531811
Svensk? Jeg kan lese litt svensk.
>>
>>54531622
jobber med universitetsoppgaver

>>54531654
dieser Faden gehört den Norwegern. schreib Norwegisch oder hör auf zu posten
>>
>>54531803
>Jeg forstår ikke engelsk
>besöker 4chan
inte säker på om trollar eller bara efterbliven
>>
>>54531791
Well, if you want the code after it to ever execute, then you need the first one because the second snippet always returns. They aren't even equivalent.
>>
>>54531860
>schreib Norwegisch oder hör auf zu posten
Aber schreibst du Deutsch!
>>
>>54531720

Depends on the circumstances and language, you stupid faggot
>>
>>54531841
come te la cavi con l'Italiano?
>>
>>54531907
Nei. Unnskyld.
>>
>>54531876
Nah. You can get there with jumps from goto and switch.
>>
>>54531720
how about
return (result>0)?0:1;
?
>>
>>54531926
That's not really relevant because the goto would have to be above - thus the code wouldn't have been executed anyways.
>>
File: NokiaN9apps-359x6402.png (149 KB, 359x640) Image search: [Google]
NokiaN9apps-359x6402.png
149 KB, 359x640
Hei dåkker

Æ e eit brasiliansk mann som har studert i norge for eit år, er det noen som kan forklare til mæ kosn æ kan gå til universitet i norge?

Also N9
>>
>>54531907
Hablo español. ¿Qué es tu problema?
>>
thread off to a good start
>>
>>54531946
Conditional goto.
>>
halla guttå

kan noen fortelle meg kort og enkelt hvordan man bygger et operativsystem i lisp?
>>
Working on my Gnu Turd microkernel for ARM64
>>
>>54531963
Kein Englisch bitte
>>
>>54531965
If the jump happens, the code will be skipped.
If it doesn't, the rest of the code won't happen if you pick the second option while it will with the first.
>>
>>54531979
*can with the first
>>
>>54531947
Hold deg ut, jævla utlending. Gå til sverige istedenfor, du.
>>
>>54531972
? (drakma:http-request "https://www.debian.org/")
>>
>>54531622
>ikke anime-bilde
fiks tråden din svarte skeiving
>>
>>54531972
veldig.... forsiktig...
>>
Quem /Portugal/ aqui?
>>
File: IMG_20150404_020527:nopm:.jpg (1 MB, 2448x3264) Image search: [Google]
IMG_20150404_020527:nopm:.jpg
1 MB, 2448x3264
>>54531997
Æ e kvitt, kan gjore norge bedre i istedet å ta ressursen fra NAV og kan lage kjottkake

Ka er det gålt med dæ?
>>
noen her på NTNU?
jeg vet at én av infosec folka er her
>>
>>54532052
Kjenna tre venner som går der, men bare en som gjor computerting
>>
>>54532038
Nei. Nei det kan du ikke.
>>
>nordmenn
>nordmenn overalt
>>
File: IMG_20160417_135559.jpg (2 MB, 2448x3264) Image search: [Google]
IMG_20160417_135559.jpg
2 MB, 2448x3264
>>54532087
>nordcuck will never ever taste gnocchi med special sauce
>>
>>54532111
DET ER DET JEG SNAKKER OM
>>
File: goodgoy.gif (41 KB, 171x199) Image search: [Google]
goodgoy.gif
41 KB, 171x199
היהודים עשו - אוי ואבוי! הם מצאו אותנו!
>>
>>54532137
jodesvin ut
>>
>>54532127
Jesus fuck, go kill yourself.

I'll be fine with my fish and potatoes, thank you very much.
>>
File: robot.jpg (26 KB, 527x373) Image search: [Google]
robot.jpg
26 KB, 527x373
Has anyone here worked with EEG headsets yet? I want to start getting to development of interactive stuff that uses commands generated form your body rather than tradition input methods and this seems great, but i don't know if the current headsets are good enough. Especially when a decent one runs $800.

I've read about it and I'm on the edge since it seems very limited and the data itself appears to be always hidden away behind their proprietary software that analyzes it rather than letting you train with it.
>>
If we could use neural networks to generate memes, would their value drop?
>>
>>54532137
Gehen Sie weg, /pol/!
>>
Endelig noen som kan hjelpe med norsk kode! Hva er problemet her:


private void lefse(int[] bunad, int neger, int polse)
{
int nsb = 0;

if (neger < polse)
nsb = quisling(bunad, neger, polse);
lefse(bunad, neger, nsb - 1);
lefse(bunad, nsb + 1, polse);
}

private int quisling(int[] bunad, int neger, int polse)
{
int pivot = bunad[polse];
int sild = neger - 1;

for (int gris = neger; gris < polse-1; gris++)
{
if (bunad[gris] <= pivot)
{
sild++;
nav(bunad, sild, gris);
}
}
nav(bunad, sild + 1, polse);
return sild + 1;
}


private void nav(int[] olje, int kaninhopp, int salmiakk)
{
int danskebåten = olje[kaninhopp];
olje[kaninhopp] = olje[salmiakk];
olje[salmiakk] = danskebåten;
}
>>
>>54532157
it's probably shit
>>
>>54532198
skrev du dette nå i farta?
>>
>>
>>54532224
forrige måned
>>
File: IMG_20150819_114147.jpg (2 MB, 2448x3264) Image search: [Google]
IMG_20150819_114147.jpg
2 MB, 2448x3264
>>54532198
Problemet er at koden er Norsk
>>
>>54532198
herlig
>>
File: 1429444554840.gif (1 MB, 500x500) Image search: [Google]
1429444554840.gif
1 MB, 500x500
>>54532234
>>
Pourquoi Python est t-il le meilleur langage de programmation ?
>>
>>54532286
fordi mora di er mann hahaha
>>
Why is the thread in Norwegian?
>>
>>54532286
google translated your question

It's the best because it's incredibly expressive. If you need shit done, you can do so without any faffing about with Python. Because of its expressiveness, people find it easier to develop packages growing its use-case and userbase together. It has come to the point where people will even develop libraries for it using lower-level languages in order to make it more expressive
>>
>>54532304
Cxar mi parolas la anglan pli bone ol la norvega.
>>
>>54532300
Fordi Norge er det beste landet i verden og vi må vise vår overlegenhet ovenfor medlemmene av /g/ ved å lage vår egen /dpt/-tråd.
>>
File: fractal01.png (797 KB, 640x640) Image search: [Google]
fractal01.png
797 KB, 640x640
Fractals in C. It's probably one of the most fun things to program and optimize, even though it's a very basic exercise.

Pic related, obv
>>
>>54532300
I know right? It should be in Hindi.
>>
>>54532319
Merci pour cette réponse.
>>
>>54532370
>keywords
(get! (out you)) 
>>
>>54532370
nei, kun idioter og megmegkode bruker noe annet enn engelsk
>>
I wish I understood how tactics work so I can figure out how Idris uses them to elaborate implicit arguments.
>>
>>54532355
that looks terrifying
>>
File: c.png (6 KB, 370x143) Image search: [Google]
c.png
6 KB, 370x143
how do I make IDA treat a value as enum only at given line?
that WHITE_BRUSH is accurate only for one line
>>
>>54532405
どうしてノルウェー語で?
ホモじゃないんですか、貴様
>>
File: file.png (571 KB, 800x567) Image search: [Google]
file.png
571 KB, 800x567
>>54532370
>Velkommen til den daglige programmering tråden.
den daglige programmeringstråden*
>>
>>54532370
only disgusting frenchies
>>
>>54532370
Dette er noe av det jeg bruker:
#define SETNING char *
#define HVIS if(
#define DERETTER ){
#define ELLERS } else {
#define SIVH ;}
#define MENS while(
#define GJORE ){
#define EROJG ;}
>>
File: :3.jpg (37 KB, 1280x720) Image search: [Google]
:3.jpg
37 KB, 1280x720
>>54532440
jeg kan tyde dine måneruner, men jeg vet ikke svaret på ditt sporsmål
>>
>>54532355
Can you make high res images?
>>
>>54532464
4chan erstattet noen tegn. Amerikanerne er det verste.
>>
I had no idea there were so many Norwegians on /g/.
>>
File: 1378306269309.png (3 MB, 1500x1092) Image search: [Google]
1378306269309.png
3 MB, 1500x1092
>>54532496
Evig og tro til Dovre faller!
>>
>>54532441
Takk. Jeg har bare lært norsk i en måned.
>>
File: 1463084012695.jpg (98 KB, 865x924) Image search: [Google]
1463084012695.jpg
98 KB, 865x924
Erm, this is the Daily Programming Thread, courtesy of Hime
>>
File: norwegian starter kit.png (3 MB, 1497x1235) Image search: [Google]
norwegian starter kit.png
3 MB, 1497x1235
>må programmere en nettside til en oblig men gidder ikke
wat do
>>
>>54532538
Fuck off weeb. This is the TECHNOLOGY board, not the GAY board.
>>
>>54532580
*Norwegian board
>>
File: voe gull norge.png (814 KB, 900x600) Image search: [Google]
voe gull norge.png
814 KB, 900x600
>>
>>54532580
>This is the TECHNOLOGY board, not the GAY board.
With you around it was hard to tell, my bad.
>>
>>54532589
I said this isn't the gay board.
>>
>>54531720
If result is signed,
return (!result);
returns true and the other one returns-- uh-- nothing

it's a bait thread i know, but blecch
>>
File: 1418394472122.jpg (84 KB, 500x844) Image search: [Google]
1418394472122.jpg
84 KB, 500x844
>>
File: skipskip.jpg.gif (10 KB, 756x407) Image search: [Google]
skipskip.jpg.gif
10 KB, 756x407
Is skip list a pretty common data structure? It's in my HW assignment, and had never heard of it before and was surprised there wasn't that many YT vids (comparatively).

Is there a specific application that people like to use them for?
>>
why the fuck are the Norwegians so good at shitposting?
>>
>>54532623
Pretty rare. I've never used one in production.
>>
File: sør vs nord.jpg (186 KB, 900x604) Image search: [Google]
sør vs nord.jpg
186 KB, 900x604
>>54532635
we ain't shitposters
>>
>>54532490
Sure, it just takes a very long time. The image I posted was originally 2560x2560 with 1000 iterations. Took 20 minutes. There is obviously a lot of room for optimization. On the other hand I only have a laptop with 4 threads.
>>
>>54532464
int (int neseLengde) {
HVIS neseLengde > 2 DERETTER
SETNING forvist = "Den evangelisk-lutherske Religion forbliver Statens"
"offentlige Religion. De Indvaanere, der bekjende seg"
"til den, ere forpligtede til at opdrage sine Born i"
"samme. Jesuitter og Munkeordener maae ikke taales."
"Joder ere fremdeles udelukkede fra Adgang til Riget.";
printf(forvist);
return 1;
ELLERS
return 0;
SIVH
}
>>
>>54532674
ser jeg kunne brukt GJORE og EROJG også
>>
>>54532654
>aint

ohhh you've done it now boii gimme back muh culture

t. burger
>>
File: 1420883862770.png (88 KB, 512x512) Image search: [Google]
1420883862770.png
88 KB, 512x512
>>54532674
>>
>norrmän i min tråd

KVÄÄÄÄÄÄÄÄÄÄÄÄÄ
>>
File: 4 - PwmTxOF.jpg (812 KB, 1920x1080) Image search: [Google]
4 - PwmTxOF.jpg
812 KB, 1920x1080
>>54532663
Well I mean, I know you can. I was asking for a higher resolution from you :3

If you happen to have the original one, of course
>>
>>54532693
>KVÄÄÄÄÄÄÄÄÄÄÄÄÄ
kek
>>
>>54532623
>Is skip list a pretty common data structure?
you're not gonna use it while making a website or an app. you might stumble upon it if you're making a DBMS. it's not common
>>
File: takk_mååt.png (9 KB, 829x71) Image search: [Google]
takk_mååt.png
9 KB, 829x71
>>54532674
>>
>foreign language
nice meme
>>
>>54532649
Cool, I won't do the HW then.

Just kidding. They're pretty interesting, but the implementation and how they're built seems goofy. I'll have to actually make one before I have an opinion, I guess.
>>
>>54532198
xaxaxa your variables
>>
File: jøde.jpg (148 KB, 754x861) Image search: [Google]
jøde.jpg
148 KB, 754x861
>>54532674
>>
>>54532737
thought that was a CPU backplate
>>
>>54531622

how many of these can you do, /g/

http://apcentral.collegeboard.com/apc/public/exam/exam_information/2000.html#free-response
>>
>>54532751
noen burde montere en CPU-kjoper på den
>>
>>54531622
>>54531651
>>54531654
>>54531734
>>54531860
>>54532021
i hope a syrian refugee will rape all of you
>>
>>54532771
You're saltier than my fish and chips m8
>>
>>54532714
Ooo, all the better reason to learn it for me. Ecommerce is stupid, I like stuff that's more applicable to how computers operate, and math/computational stuff. I like the computer "science" stuff.
>>
File: fractal02.jpg (2 MB, 2560x2560) Image search: [Google]
fractal02.jpg
2 MB, 2560x2560
>>54532710
The problem is that there's no antialiasing at all in without any supersampling. And files are large and hard to compress. But here you go.
>>
int är_jude(int näslangd, int kuklängd) {
return (näslängd > kuklängd);
}
>>
>>54532771
är du arg eller, american hamburger?
>>
>>54532796
thank you.
>>
>>54532771
Ich bin Amerikaner, Freund
>>
>>54532800
solid kode söta bror
>>
>>54532800
har du nu en riktigt dunderkuk?
>>
>>54532817
t. rövsmärtad hamburgare
>>54532818
större än min näsa i alla fall
>>
>>54532800
liker at du bruker slange_bokstaver og ikke kamelBokstaver
>>
>>54531622
Hva faen?
>>
>>54532755
looking through it now, but don't like the fact that 2016 already says Java
>>
>>54531935
Lad, just negate the expression
>>
>>54532817
trodde alle brukte ISO 8859-1
>>
>>54532592
Does norway do anything except drill oil?
>>
File: rullestolhallik.png (2 MB, 1271x955) Image search: [Google]
rullestolhallik.png
2 MB, 1271x955
SLAPP AV - KONGEN HAR ANKOMMET
>>
>>54532843
not always equivalent for all inputs
>>
>>54532856
>rullstolhallick
>>
>>54532850
Vi bader i pengene våre.
>>
>>54532856
shieet, å linke denne tråden i norgetråden var visst et feilgrep
>>
>>54532858
Pretty sure
return !(result>0)
would return the same...
>>
>>54532884
is this portugese
>>
>>54532884
Enjoy your wealthy happy life faggot.
>>
File: hmmm.jpg (484 KB, 1600x1200) Image search: [Google]
hmmm.jpg
484 KB, 1600x1200
>>54532889
Hva mente han med dette?
>>
File: 1393996672864.gif (1 MB, 245x184) Image search: [Google]
1393996672864.gif
1 MB, 245x184
>have to take a prog. class
>language is C++
>forgot how much I hate this language
>first project is a pretty long singly-linked list
>crippling laziness prevents me from actually making progress

How do you relax/concentrate on your projects /dpt/?
>>
>>54532892
Just because boolean types can be converted to numbers in a lot of languages doesn't mean they're equivalent
>>
>>54532913
Music
>>
>>54532684
de er gyldige C, men ikke idiomatisk algol
>>
>>54532913
>singly linked list
>hard
literally each node has 2 variables, its value and a pointer to the next node

that's it
>>
>>54531622
Norgeboo, er det deg?
>>
>>54532913
Music but mainly off knowing what I am doing. If I have doubts when implementing / writing, I get stuck and become not-proficient.
>>
>>54532913
Also student here.
If your class is popular enough, you can always look it up on GitHub
I usually find about 4-5 projects from any course I'm taking
>>
File: 1378237089344.png (318 KB, 635x311) Image search: [Google]
1378237089344.png
318 KB, 635x311
>>
>>54532977
Or just don't be an idiot?
>>
>>54532198
bare kall lefse når neger < polse, ellers blir den evig rekursiv:

    if (neger < polse) {
nsb = quisling(bunad, neger, polse);
lefse(bunad, neger, nsb - 1);
lefse(bunad, nsb + 1, polse);
}



Loopen er også off by one, slett -1:
for (int gris = neger; gris < polse; gris++)
>>
>>54532987
er det en BAOT-IS jeg oyner?
>>
>>54532997
stemmer det
>>
What's the go-to source for learning Haskell?
>>
>>54532999
det var et meget flott bilde. kan jeg lagre det på datamaskinen min?
>>
>>54531622
Nice boat
>>
>>54533009
det får du gjerne gjǿre
>>
>>54532812
you're gonna get """"""""refugees"""""""" too especially if you elect shillary
>>
>>54532989
There are enough people on in this thread to call an idiot, I'm just selling tips for lazyfags
>>
>>54533021
tusen takk, kompis!
>>
>>54533005
SICP is probably the best source since pure and static functional languages are a meme.
>>
>>54533055
Enjoy only finding out about your mistakes at runtime.
>>
>>54533070
nice meme
>>
>>54533070
That's fine since interpreters exist.
>>
>>54533083
Eh, it's your funeral.

I've been playing with dependently typed stuff at work recently and it's pretty awesome, even though my IDE can't handle it.
>>
Hey /g/, I have a window program written in C using glfw3. I have a function that gives me the x position and y position of the mouse. Thing is, I want the change in the mouse's position, so I need to subtract the current mouse position from the one prior to get a difference. Problem being any variable I make in the function is temporary. I thought I could use a pointer instead to keep the value outside of the function and just pass it in, but there is a glfw3 particular function call that does the mouse position stuff and I don't know how to pass it in. Should I just try a global variable? Beginner C programmer.
>>
>>54533102
wut
>>
>>54533111
What language?
>>
>>54533119
Discovering errors at runtime isn't a big deal since you don't have to compile code tripfag.

Not to mention the majority of errors people make anyway even with static languages are only discovered at runtime.
>>
>>54533111
>my funeral
I use python at work, and runtime errors are 5% compared to the 95% implementation errors, and at that point, python's constructs more than make up for it
>>
>>54533142
Scala. Yeah, I know, but it's the best my employer will let me use.
>>
>>54533112
I'm not entirely sure what you are trying to do here. If you want the difference between two points of a mouse just create two xpos and ypos variables.There is no limit to how many you can use.
>>
>>54533112
Give context.
>>
>>54533112
Yes globals are legitimate in that circumstance.
>>
>>54533119
Static language
>time taken to compile
>tests written for everything you write
>find out about most errors at run time, havning to compile->run to test whether functionality still works in a live environment

Dynamic language
>time taken to run
>tests written for everything you write
>find out about most errors at run time, having to run to test whether functionality still works in a live environment

I've used Java, C++, Python and JS professionally. Static/dynamic makes VERY little difference, although I prefer dynamic since it's usually more expressive, quick to run, and less anal about what data types you can throw around.

muh safety doesn't mean shit considering you have to write a shitload of tests either way if you are in a professional environment
>>
>>54533112
Paste the code, let people laugh, and then hope someone will fix it.
>>
>>54533146
>Discovering errors at runtime isn't a big deal since you don't have to compile code tripfag.
When you notice a bug at runtime, you have to close the program. Make a guess what the cause might have been (often very cryptic). Run the program again. Restore it to the state it was in when you noticed the bug (can take a long while depending on the application). Then see did you really fix it. Often you need to do this multiple times. With static typing, you find the error at compile time. The compiler tells you exactly where and how you made the mistake. You fix it. Compiler verifies it's fixed. Some programmers are too dumb to realise this is faster.

>Not to mention the majority of errors people make
When ever I worked with someone who claimed this I simply had to point out how the root cause of most of the filed bugs would have made them impossible to occur with static typing. Dynamic typing advocates just can't connect the dots.
>>
>>54533167
Ouch man.

No chance of being allowed to use F# anywhere i guess.
>>
>>54533214
>you have to close the program. Make a guess what the cause might have been (often very cryptic).
This is cryptic to you?:
<syntax>          (map (lambda (x) (+ x (quote c))) (list 1 2 3 4))
<syntax> (lambda (x) (+ x (quote c)))
<syntax> (##core#lambda (x) (+ x (quote c)))
<syntax> (##core#begin (+ x (quote c)))
<syntax> (+ x (quote c))
<syntax> (quote c)
<syntax> (##core#quote c)
<syntax> (list 1 2 3 4)
<eval> (map (lambda (x) (+ x (quote c))) (list 1 2 3 4))
<eval> (list 1 2 3 4)
<eval> (+ x (quote c)) <--
>>
>>54533203
>time taken to compile
dynamic langugaes are compiled too anon.
>tests written for everything you write
not true. And unit tests have nothing to do with static or dynamic typing.
>having to compile->run to test whether functionality still works in a live environment
You're confusing dynamic typing and scripting anon. Statically typed langugaes can be scripted.
>>
>>54533214
That's why you write tests, and fill your draft programs with print commands so you can unroll loops to make sure shit is being done properly.

Compiler doesn't catch everything, you still need tests just ask OpenSSL how that worked out for them
>>
>>54533112
tell us the fucking function and we can see if it has any context you can make it pass to the function, otherwise just use a global
>>
>>54533247
Accidentally didn't copy the whole thing. Here's a bit at the top:
Error: (+) bad argument type: c

Call history:

>>
>>54533184
Alright, my description sucks. Let me see if i can do code tags.

static void cursor_position_callback(GLFWwindow* window, double xpos, double ypos)
{
printf("pos x:%lf\n", xpos);
printf("pos y:%lf\n", ypos);


float m[4][4] =
{
{1,0,0,0},
{0,cos(ypos/10000),sin(ypos/10000),0},
{0,-sin(ypos/10000),cos(ypos/10000),0},
{0,0,0,1}
};
glMultMatrixf(&m[0][0]);
}

here is the actual function. It's standard to glfw3 for handling mouse movement. I'm using it to manipulate a rotation matrix applied to the camera.

    glfwSetCursorPosCallback(window, cursor_position_callback);

this is where the callback is set up. It almost looks like it calls the cursor position callback function, but nothing is passed in.

       glfwPollEvents();

This is where the above cursor position callback is actually called in the code (inside the main loop drawing stuff; its opengl stuff). I can't really figure out where I'm supposed to establish a variable to hold the old values for xpos and ypos of the mouse without the function they are used in (cursor_position_callback) as it destroys the instance the variables exist in upon completion. Not sure if I'm using all the right words, kindof a beginner.
>>
>>54533214
>you have to close the program
Nope, and it depends on your debugger
> Make a guess what the cause might have been (often very cryptic)
Depending on your debugger, you can run multiple expressions given the code's current state, making this step very quick
>Run the program again
Nope, you write a test with asserts that is run automatically given your test framework

>With static typing, you find the error at compile time.
Nope, not all errors are type errors
>The compiler tells you exactly where and how you made the mistake
Just like a good debugger/interpreter
>Compiler verifies it's fixed
Yep, you go through the time to compile only to reaffirm that your type error is a type error, and your non-type error wasn't a type error
>>
>>54533266
use static variables
>>
>>54533262
no, it's not cryptic to me. Why?
>>
>>54533252
>dynamic langugaes are compiled too anon.
Not when you're running them in an interpreter
>not true
In a professional environment, very true. Nowadays, you even have to make sure your tests give you 100% code coverage, or your conditions/tests are too shit to push live
>You're confusing dynamic typing and scripting anon. Statically typed langugaes can be scripted.
Not a live environment at that point
>>
>>54533255
>That's why you need to write tests
Thanks for making my point for me

>Compiler doesn't catch everything
Yes, it justs catches a lot of things. Therefor it's useful.

You might as well say "don't write tests because they can't catch everything".
>>
>>54533223
Nope. We're a JVM shop, with most teams using Java. My boss and I had to fight to even get Scala.

To be honest I'd prefer Haskell over F#. Probably because I'm more used to its features - you can do a pretty good approximation (well, pretty good compared to almost every other mainstream programming language) of typeclasses, monads, transformers, etc. in Scala, so switching to Haskell would probably be easier for me than switching to F#.

>>54533214
Nail on the head.

Dynamic typing:
>lookup a key in a map
>if it's not there, you'll silently pass null/undefined/whatever around from it and only find out somewhere else
>if it's there, it's up to you to remember what type it is, and nothing's stopping you from performing unsupported operations on it
>only find out about either of these problems later on, possibly with no idea of the original cause

Static typing:
>lookup a key in a map
>if it's not in the map, the compiler will refuse to compile the lookup
>if it's there, the compiler knows what type it is, and won't let you perform unsupported operations on it
>>
>>54533288
That's what a stacktrace of a dynamic language looks like.
>>
File: kill me please.jpg (4 KB, 276x183) Image search: [Google]
kill me please.jpg
4 KB, 276x183
>gonna start applying for jobs
>already feel stupid after looking at /g/
>tfw gonna get rekt at interviews
>gonna get rekt with interview questions

how do I cope with getting shit on by interviewers?
>>
>>54533266
Just stuff it in a class.

Also I may be missing key info, but use glfwGetCursorPos() to retrieve cursor position.
>>
>>54533306
>Thanks for making my point for me
Guy who uses Java/C++/Py/JS professionally here

You write just as much tests either way. The goal is total code coverage, and making sure that your code doesn't throw a shitfit no matter what barren environment it's in

>Yes, it justs catches a lot of things.
Almost none of the errors I find upon compilation/runtime are type errors. You must be really shit at programming
>>
>>54533325
I came here to get shit on first. Hopefully people on interviews are nicer than /g/.
>>
>>54533325
Don't lie on your resume, and don't tell the interviewer you think his/her questions aren't useful. That'll put you above a good chunk of the other applicants.
>>
>>54533214
>close program
emacs is an OS, you never close it

>static typing
what is Typed Racket (scheme)

You still have to write unit tests after running GHC (i assume you use Haskell) so same amount of time except I still agree with you to prefer a statically typed lang than not esp for gigantic programs.
>>
>>54532977

Eh, I'de rather not copy.

>>54532932

Sorry meant doubly linked.
>>
>>54533336
That's a totally unnecessary abuse of OOP. A static inner variable is legitimate.
>>
>>54533268
>you write a test
yes, this takes time. Why not just have the compiler do the test automatically without you needing to write one?

>not all errors are type errors
I know.

>Just like a good debugger/interpreter
only after you run the program and bring it to the state with the bug. Or write a test that will do it for you.

>only to reaffirm that your type error is a type error, and your non-type error wasn't a type error
You seem bad at reading. The compiler tells you where you made a mistake and how to fix it. This saves a lot more time than the seconds it takes to compile. Most dynamic langugaes are compiled too you know.
>>
>>54533325
go on codility and solve some shit
go on glassdoor and look up prev interview questions for places you want to apply to

start at support engineer or something, work way up to F/T dev
>>
File: 130516-2321.png (2 MB, 4000x2560) Image search: [Google]
130516-2321.png
2 MB, 4000x2560
Just working on some cracking challenges. Another one solved.. Onto the next.
>>
>>54533320
and?

Wouldn't it be nice to get that exact error at compile time and not have to run the code first and get the program to the state where that code is run?
>>
>>54533366
Nobody anywhere is simply relying on a compiler to catch errors, absolutely everybody runs (usually custom) unit tests, logic tests, stress tests, ect.

Compiler misses plenty of things, I can write a million programs that will compile with no warnings but give seg fault. This is why they invented Valgrind
>>
>>54533325
The fact you make /g/ company despite acknowledging your inferiority, rather than going to some hugbox website where everybody will jerk you off tells me, as an interviewer, that you are willing to improve and may even be better than you think you are. Sitting at the bottom of a barrel filled with wine is preferable to floating on the top of a barrel filled with piss.
>>
>>54533377
Not really. The error is found when you do something like ./unit-tests.sh

And "at at compile time," assuming compiled languages could just be a script consisting of
make debug
./unit-tests.sh
>>
>>54533366
>yes, this takes time. Why not just have the compiler do the test automatically without you needing to write one?
What the fuck are you talking about? Tests are not just about 'does it work'. It's about automating the testing of your functionality so that when you change something in your code, you don't have to run it to see if your code still works.

>only after you run the program and bring it to the state with the bug
So pretty much like a static language where the issue isn't type (considering that usually the issue is not type, and more an implementation issue)

>The compiler tells you where you made a mistake and how to fix it.
Only compile-type errors which are not even a decent-sized fraction of the errors you get if you actually did this for a living.
>>
File: 1444805576558.jpg (44 KB, 544x509) Image search: [Google]
1444805576558.jpg
44 KB, 544x509
>>54533360
>Unnecessary abuse of OOP
>>
>>54533343
>You write just as much tests either way. The goal is total code coverage
If the compiler is testing a lot of stuff for you, that means you have more time to write other tests. You can never reach true global coverage, but the compiler can help you a lot.

>Almost none of the errors I find upon compilation/runtime are type errors.
I'd love to see the codebases you work on. In every dynamic typing codebase I've worked on I'm always seeing shit like
>object of Undefined does not contain member "blah"
or
>object member "dicks" is not a function
not to mention null reference errors, which plague a lot of statically typed langugaes too.
>>
>>54533377
You'll never convince most dynamic typing fans. They see the ease of initial development, and never the cost of maintenance or adding new features to code written in a dynamic language. The productivity they claim to possess in such languages is an illusion.
>>
>>54533266
>glMultMatrixf
D E P R E C A T E D
>>
>>54533389
>Nobody anywhere is simply relying on a compiler to catch errors
Nobody claimed that. But people do relying on a compiler to catch errors, even in dynamic langugaes. Because it is useful.

>Compiler misses plenty of things
So do unit tests. Do you think unit tests are stupid too?
>>
>>54533391
>unit-tests
memes on top of memes
>>
>>54533414
The code will die in the unit tests if you make a type error, and the stacktrace will be very descriptive. It's not that hard.
>>
>>54533391
but then you have to write that unit test. And it might itself contain bugs and miss things due to programmer error than a static compiler might catch.

Why bother writing a unit test to check types when you can get the compiler to do it for free?
>>
>>54533410
I do this for a living. The more work I can make the type system do, the better.

Tests are existential. Type checking is universal.
>>
>>54533376
What challenges are you doing?
>>
>>54533414
>If the compiler is testing a lot of stuff for you
Usually not the case. Unless you're shit at programming, you add functionality, compile and it goes through. Maybe you haven't used static languages enough and you're just arguing conceptually, but 'compiling to save time' makes no sense.

>I'd love to see the codebases you work on.
Java/C++ - A hotel management system, for any of their needs, including bookings, restaurants, events, etc
Python/JS - A marathon management system, for keeping track of entrants, payments, products in shop, etc

>>object of Undefined does not contain member "blah"
>object member "dicks" is not a function
Maybe wake up when you work
>>
>>54533434
What is your argument then.

First it was "Compiler saves time finding errors!"

Then you concede that you still have to run the exact same unit tests after just like anybody else would. So essentially compiling takes more time (unless it's Go) since you have to both compile + run a full suite of tests.
>>
>>54533454
I think you need to re-evaluate what an error is. If a type error is an error, then the tests will not complete successfully. If a "type error" is not an error, then the tests will execute correctly.

As such all type errors are caught "for free" by testing.
>>
>>54533410
>Tests are not just about 'does it work'. It's about automating the testing of your functionality so that when you change something in your code, you don't have to run it to see if your code still works.
that basically is still testing 'does it work'. I agree, tests are great. Including static typing tests done by the compiler.

>So pretty much like a static language where the issue isn't type
Exactly. I don't where you're getting that i'm suggesting anything else.

>Only compile-type errors which are not even a decent-sized fraction of the errors you get if you actually did this for a living.
I do do it for a living. I've met plenty of people who claimed the same shit, but none who can demonstrate it's true in their own codebase. Simply people who can't figure out what bugs static typing would have prevented and how easily.
>>
>>54533455
The type system will barely help in even a mediocre codebase since type errors are only a thing for people who can't read, or people who don't use IDEs, ie people who don't do this for a living
>>
>>54533426
is it? Should I avoid manipulating the networking stack directly entirely or is there a new function for it? GluLookAt doesnt do what I want.
>>
>>54533487
*matrix stack... wow
>>
>>54533487
Use glm.
>>
>>54533441
only if you write tests for every type.

>It's not that hard.
It's harder than doing nothing at all. Like in a statically typed language.
>>
>>54533458
ur mum
>>
>>54533487
>>54533498
it's ancient

https://www.opengl.org/wiki/Fixed_Function_Pipeline
>>
>>54533506
But his mum isn't challenging.
>>
>>54533483
>that basically is still testing 'does it work'.
Nope, because a compiler's job is to compile, not to run through your functionality as a naive user would in a live environment

>Including static typing tests done by the compiler
Again, this free service is negligible when:
- Type errors are not a common occurence
- Dynamic typing allows you to be more expressive, and therefore more productive

>Exactly. I don't where you're getting that i'm suggesting anything else.
That having to bring a program to a state where a bug happens is a bad thing

>I do do it for a living. I've met plenty of people who claimed the same shit, but none who can demonstrate it's true in their own codebase
Well that's an issue with the people you've met
>>
>>54533479
>If a "type error" is not an error,
When the fuck is a type error not an error? When would you be okay with any kind of type error?

>"for free" by testing.
writing tests isn't free
>>
>>54533485
When you think of static typing, do you think of languages like Java? Because that's almost at the bottom of the barrel when it comes to type systems.

I'd think static typing was a bad idea too if the best statically typed language was Java or C#.
>>
>>54531720
The first one can't handle negative values, so the second is correct.
>>
>>54533503
>only if you write tests for every type.
Why would you? You don't need to test what type an iterable is if it can iterate, you don't need to test what type a numeric value is if it can be used in the chosen context, etc
>>
File: useless.png (90 KB, 433x454) Image search: [Google]
useless.png
90 KB, 433x454
>>54533479
>As such all type errors are caught "for free" by testing.
>>
File: [tilting increases].png (27 KB, 500x500) Image search: [Google]
[tilting increases].png
27 KB, 500x500
>>54533527
>>
>>54533503
You write tests for input and output, not tests for types. If the output is correct for all sorts of abusive input, and if the module you designed can handle the abuse in the appropriate manner, then you're A+.

>>54533523
You don't fucking write tests for types. You write tests for input and output. The compiler is not a substitute for input and output. That's why type errors are tested "for free." Any type business that causes your code to err is caught because your code errs.
>>
>>54533527
Static typing where the types are explicit.

The differences in my work projects feel like static typing is needless sanity checking. I feel more productive with dynamic languages (without experiencing these so-called type errors that are supposedly such a scare for static typing advocates) as no type system allows me to express vastly different constructs, than I do with static typing where I'm just reiterating what is already obvious.
>>
>Ser på film mens jeg koder
>tilfeldigvis en vietnam film
>DET ER IKKE MEG spilles i bakgrunnen
>>
holy shit the dynamic shitters are obviously doing web dev or some simple shit like that where the requirements are very low

dynamic typing is clearly inferior to static typing there's no question about it
>>
>>54533588
You don't have to resort to assumptions, I'm sure you have some fight left in you
>>
>>54533583
>I feel
fag
>>
>>54533522
Okay, real thing that came up at work a couple months ago.

>have a service that you can query metrics from
>specify a list of attribute keys with the query
>the returned metrics should have those attributes with those keys and only those keys
>encode the attribute map as an hlist that associates each attribute with its key, so you can only look up attribute keys in the map that you originally queried for
>some time later, write some code to get risk metrics
>due to a copy and paste error, try to get an attribute out of the map that doesn't exist
>compiler says no, the attribute map doesn't contain that key

You can make these sorts of errors into type errors in a sufficiently expressive type system, and then the compiler can catch them for you, rather than you having to write endless unit tests.
>>
>>54533608
You can't measure productivity in the same way considering they are very different types of products
>>
>>54533500
>>54533510
>https://www.opengl.org/wiki/Fixed_Function_Pipeline
So am I looking at learning shaders or should I use glm for matrix multiplication? At this point should I switch from C to C++? I think glm is in C++ so i guess there's no avoiding it.
>>
File: emperor-palpatine.jpg (13 KB, 553x401) Image search: [Google]
emperor-palpatine.jpg
13 KB, 553x401
>>54533483
Static type checking attempts to use compile time information to make claims about the runtime behavior of a program. This technique obviously fails to the extent that the runtime environment diverges from the compile time environment. Dynamic type checking, on the other hand, has no such limitation: it has perfect fidelity to the runtime environment because it occurs within that runtime environment. Even if the runtime environment itself changes at runtime!

Here's a concrete example. You compile a Haskell program that dynamically links a package. You then install a newer version of the package, which has an incompatible API change. Your program, which reported no type errors, now has a type error (a static typist may not agree this is a type error, but a dynamic typist would assert it is). And if your program starts at all, it will likely fall over and die, because GHC's codegen is brittle against such changes.

Now you are down a rabbit hole since you are not given a readable exception during runtime tests.
>>
>>54533624
learn shaders

you don't really have to switch to C++ at this point, not until you start making a game or something
>>
>>54533624
Oh, you're using C. Don't use GLM.

I'm sure there are equivalent C libraries.
>>
>>54533624
You'll have to learn shaders for opengl. Fast opengl is shader based. No reason for C++.

If you're cool with your program not being fast, then don't worry about deprecated functions.
Thread replies: 255
Thread images: 37

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.