[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: 351
Thread images: 24

File: tmp_22320-148445050693611611141.png (102KB, 1000x1071px) Image search: [Google]
tmp_22320-148445050693611611141.png
102KB, 1000x1071px
What are you working on, /g/?

Old thread: >>59397998
>>
>How can I split up a string based on commas or something
import std.stdio;

void main(){
string target = "ceial,ceiwu,382u";
string[int] splits;
int splits_count;
foreach(character; target){
if (character != ','){
splits[splits_count] ~= character;
}else{
splits_count += 1;
}
}
writeln(splits.values);
}
>>
>>59403615
First for OCaml. It's fast.
>>
>>59403653
It's fast but not as standardized as standard ml. Also the syntax sucks compared to sml.
Also fuck GIL.
>>
>>59403644
>>59403653
OCaml confirmed for slow.
>>
>>59403653
Rip. But yeah OCaml is my favorite language and ecosystem.
>>
>>59403693
One tier slower than C++ is a pretty good assessment of OCaml's perf.
>>
>>59403615
I never got why she's wearing a Fez.
>>
>>59403644
#!/usr/bin/awk
BEGIN {RS = "," }
{ for (i = 0, i < NR, i++) { print $(i) }}
>>
>>59403726
The Sussman.
>>
>>59403686
>Also the syntax sucks compared to sml
True enough. It's the reason I unironically like Facebook's Reason, even with its heretical curlies.

https://facebook.github.io/reason/mlCompared.html
>>
OK so how does Node.js actually work? Why does it even exist since V8 can apparently be embedded into any application?
>>
File: 1478585393158.jpg (109KB, 900x900px) Image search: [Google]
1478585393158.jpg
109KB, 900x900px
>>59403759
Wrong board
>>>/pol/
>>
>>59403785
/wdg/ is not here
>>
>>59403798
It's an actual programming question about the internals of the program you moron. It's not about web pages. It's a C++ question.
>>
>>59403716
That wasn't C++.
>>
>>59403785
I haven't used node.js, but V8 is just JavaScript. As I understand it, node.js is an HTTP server implementation in JavaScript, quite simply. Just like Apache is an HTTP server implementation in C.
>>
>>59403795
I used to think /pol/ was a satire board until they started doing this other places. What gives?
>>
>>59403875
If you keep pretending to be stupid, eventually you end up attracting actual stupid people.
>>
What else should I do with this to make it more interactive without spending money for hosting it?
http://labyrinth.pythonanywhere.com/
>>
can someone please explain to me what and how java works?
>>
Find the biggest common substring between two strings. Let's see how beautiful your codes are.
>>
Generating random map using Perlin noise.
>>
How do I make my own programming language?
>>
>>59403968
dragon book
>>
File: how to make a compiler.png (22KB, 1194x190px) Image search: [Google]
how to make a compiler.png
22KB, 1194x190px
>>59403968
Why do people keep asking this question?
>>
File: 23b14ed2dccbd122e87de77f7927056.jpg (52KB, 330x488px) Image search: [Google]
23b14ed2dccbd122e87de77f7927056.jpg
52KB, 330x488px
I submitted a video recording of my project to my teacher with an anime background. It was super late and i was super tired, i didn't even think about it until i woke up

Am i fucked?
>>
>>59404100
Yes. Anime is totally forbidden in academia. Now you need to learn how to eat nuts and leaves while you build bombs in the woods.
>>
>>59403922
What?
>>
>>59404192
I think he's asking about the JVM.
>>
>>59404100
You ain't.
>>
Alright what is some very easy to implement from scratch hashing algorithm? Doesn't have to be super secure, but should be giving completely different hash for each input.
I was thinking of doing MD5 but after reading a bit about it, seems a bit complicated (or poorly explained).
>>
>>59404100
Yes anon, the only way out is to send him your whole moe folder to make him understand you do have a special case of autism that justifies such a background picture.
>>
>>59404298
>but should be giving completely different hash for each input
That's impossible for as long as you accept inputs longer than the hash (pigeon hole principle).
>>
I wrote a *nix shell in D. The code looks beautiful in comparison to Bash. But seeing it's worthless I deleted the project.

Also, I'm officially a criminal now (tax evasion). Guess I have to disappear for a while.
>>
>>59404100
Having an anime background is indicative of a deviant mind that must be purged
>>
>>59404338
What I mean is that at least they don't look similar. Like for example:
'Test' in MD5 is 098f6bcd4621d373cade4e832627b4f6
'Test! will be c4d354440cb41ee38e162bc1f431e99b
Small difference in input, but the hash is very different.
>>
>>59404353
In what shithole is that a """"'crime""""'?
>>
>>59404100
No, he is probably an anime lover as well.
>>
>>59404353
Are you implying that tax evasion has some connection to the shell you wrote?
>>
>>59404416
All of them?
>>
>>59404462
Not in mine certainly, although it's not """"""""officially"""""""" recognized or whatever.
>>
>>59404481
I think your substitute greentext key is broken.
>>
>>59404353
It's raining outside although the sun is up. I'll start packing my stuff after I finish my breakfast.
>>
>>59404298
State your purpose. Do you want to detect corrupt data?
>>
>>59404497
Why would you think so? I'm just pissed off.
>>
>>59403929
I think my algorithm is correct.
It's a pretty typical dynamic programming solution.
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

const char *lcs(const char *a, const char *b, size_t *out_len)
{
// +1 for the empty string column/row
size_t a_len = strlen(a) + 1, b_len = strlen(b) + 1;
size_t (*sol)[b_len] = calloc(a_len, sizeof *sol);

if (!sol)
exit(1);

// Coordinates to the best known solution
size_t max_x = 0, max_y = 0;

for (size_t i = 1; i < a_len; ++i) {
for (size_t j = 1; j < b_len; ++j) {
if (a[i - 1] == b[j - 1]) {
size_t len = sol[i - 1][j - 1] + 1;
sol[i][j] = len;

if (len > sol[max_x][max_y]) {
max_x = i;
max_y = j;
}
}
}
}

*out_len = sol[max_x][max_y];
const char *ret = a + max_x - sol[max_x][max_y];

free(sol);
return ret;
}

int main()
{
size_t len;
const char *s = lcs("Hello my name is Chris Poole.", "name is Poole.", &len);

printf("%.*s\n", (int)len, s);
}

It's using size_t for a lot of things, which is pretty wasteful on memory space, but it's more "correct".
Changing them to "unsigned" would probably be appropriate.
>>
>>59404742
what esoteric programming language is that?
>>
>>59404766
I like this post
>>
Is it actually viable to be able to get some freelancing jobs as a programmer? I keep seeing articles all over the place about how programmers are in huge demand and it's not like the demand is going to be any smaller as long as computers and the internet exist
>>
File: crack2.jpg (167KB, 1275x749px) Image search: [Google]
crack2.jpg
167KB, 1275x749px
trying to code up a binary search algo on C, but I keep fucking it up. The search function takes a target value, an int array and the size of the array. Then I set up start end and mid points, and then I start going through the array.

Problem is, start end and mid get fucked up first run into the search and then it never finds the target. What am I doing wrong?
>>
>>59404742
>size_t (*sol)[b_len] = calloc(a_len, sizeof *sol);
wtf
>>
>>59404766
Haskell
>>
>>59404818
bool search(int value, int values[], int n){

int target = value;
int startx = 0;
int end = n - 1;

while (true){
int mid = (end - startx)/2;

if (values[mid] == target){
return true;
} else if (values[mid] > target){
end = mid - 1;
} else {
startx = mid + 1;
}
}
>>
>>59404742
ugly
>>
>>59404818
>>59404848
and I know the function is not done, I need to add restraints to determine what happens when end and start coincide etc, but this is the first step and it's not working...
>>
>C programmers find this difficult
    type String_Access is access constant String;
type String_Args is array (Integer range <>) of String_Access;
function Test (Items : in String_Args) return String is
Size : Natural := 0;
begin
for I of Items loop
if I /= NULL then
Size := Size + I'Length;
end if;
end loop;
declare
S : String (1 .. Size);
Index : Positive := 1;
begin
for I of Items loop
if I /= NULL then
S(Index .. I'Length + Index-1) := I.all;
Index := Index + I'Length;
end if;
end loop;
return S;
end;
end Test;
>>
>>59404820
It's a pointer to a VLA.
Jesus christ, do you not even know C?
>>
>>59404879
What IDE is this?
>>
>>59404896
>difficult
>anything with script kiddie syntax like visual basic
>>
why aren't you making a next gen watch paint dry video game?

https://www.youtube.com/watch?v=OLPxxTCnuqU
>>
>>59404902
cs50.io, from edx online courses. just register for free to the cs50x course and you're in. But it's a bit slow, imo. It's all cloud-based
>>
>>59404896
>>59404922
Real programming languages look sharp like a knife. Because you might cut yourself trying to use them.
>>
>>59404896
>Test
What does it do?
>>
>>59404922
I don't even know what you meant by that
>>
Is there anything more soul-destroying than having to work with a shitty build system?
>>
File: 1487137509168.jpg (90KB, 630x583px) Image search: [Google]
1487137509168.jpg
90KB, 630x583px
Hey guys, I'm now trying to learn programing at codecademy.com!
What am I in for?
>>
>>59404968
Exactly
>>
>>59404967
Basic string concatenation, from the looks of it.
>>
>>59404945
That might actually be your problem
If you need an IDE with breakpoints so badly, you might want to try codeblocks, or visual studio code with C/Cpp plugin, or emacs/vim + gdb
>>
>>59405010
Sick burn, dude
>>
>>59405034
I think the breakpoints on the debugger are fine, they've worked before. And even if I run the thing without the debugger, it still won't work.
>>
>looking for program to do a not-quite-trivial-that-I-want-to-write-it-myself task
>promising SO link
>some guy has written something
>it's in fucking Python
Fuck Python, fuck pip, fuck the prevailing anti-intellectual programming culture, fuck shitty garbage langs
>>
>>59405007

Imagine yourself as a royalty. You will know how to knock with a hammer but you wouldn't know why the fuck should i hammer a nail.

After learning from codeacademy, be sure to actually learn from source codes and stuff.

talking from experience myself, i knew how to do stuff in the terminal but transitioning to creating a program i just hit a wall because you have to pull out everything you have learnt
>>
>>59405103
rude
>>
>>59404999
Having to use Windows.
>>
>>59405156
I don't want to delet my gay mens though
>>
>>59405126
I mean it, Python is fucking cancer garbage
>>
>>59405103
Python is fine for stuff that doesn't require high performance.
>>
is there a "research" in programming? im in software engineering but i realllllyy love math so i thought it would be neat.
>>
File: wrong.gif (1MB, 480x287px) Image search: [Google]
wrong.gif
1MB, 480x287px
>>59405208
>>
>>59404818
Skip using their weird debugger, just sprinkle in some printf's until you find where that value is getting changed
>>
>>59405208
python is disgusting as hell. at best you would use it for one-off quick little scripts, not for viable commercial software applications
>>
>>59405233
Nice ``argument", faggot. Let me guess, you're one of those people that think while loops are a ``leaky abstraction" and insist on using gotos and bitshifts to write your fizzbuzz programs?
>>
>>59405233

so do you use assembly to write webpages faggot?
>>
>>59405209
>math
I thought we were just overglorified puzzle enthusiests
>>
>>59405208
Python isn't good for anything.
>>
File: fullspeed lighting sims.png (549KB, 1154x605px) Image search: [Google]
fullspeed lighting sims.png
549KB, 1154x605px
I'm working on volumetric 3d rendering right now for these clouds.
What would be my best option for preventing rendering / reducing operations in the empty spaces? All of the algorithms that I can find use structures that would only be efficient at the CPU level, or that would result in excessive branching.

Also, is it possible to compile shaders that have early termination for optimization in a reasonable amount of time? Mine always take ages to compile due to all the branches that need to be made.
>>
>>59405255
Yet you're apparently okay with ``commercial software applications" being written in Java, Javascript, and PHP...
>>
>>59405272
>write webpages
do you know which thread you're posting in? fuck off to >>>/g/wdg
>>
>>59405208
>Python is fine for stuff that doesn't require low memory usage or speed
ftfy
Even doing a bunch of string manipulation can cause pythons memory manager to go fucking nuts and eat up GBs of memory

>>59405209
Yes, a ton actually. Get in touch with your university and see what they've got going on, data scientists are always in demand.
Also, learn R. And Matlab. Probably Mathematica.
>>
>>59405280
So then what would you use when you want to write something quickly and don't care about performance?
>>
>>59405287
>Java
absolutely. java isn't nearly as bad as you autistic memers want to think it is

>Javascript, and PHP
for webshit, yes
>>
File: languages3.png (17KB, 522x384px) Image search: [Google]
languages3.png
17KB, 522x384px
>>59405208
>>59405257
>>59405272
>>59405287
>>59405297
>>59405302
>>
>>59405209
>"research" in programming
A few things my department does related to programming itself:
>Lambda calculi (mathematical background behind one of the computational model)
>Formal systems (Mathematically define types and semantics and other things)
>Formal verification (Use formal systems to confirm programs behave correctly, includes formal proof like Coq and Isabelle)
>Parallel compilation (manage to vectorize non-trivial program source codes)
Quite a bit indeed.
>>
>>59405302
Lisp.
>>
>>59405345
idris, haskell
>>
>>59405345
Ruby has fast development.
Go has good performance. Not C/++ good, but better than Java or what-have-you.

Python has nothing.
Nothing at all.
>>
>>59405284
You'd be surprised at how well sparse octrees work on the GPU.
>>
I want to fork a game written in C, and I cannot decide if I should continue working on it in C, or "upgrade" it to C++ - first by simply getting it compiling, and then over time gradually get rid of C-isms through refactoring as I work on it (not all at once).
>>
>>59405345
>>59405354
>>59405368
>>59405385
>tfw you fell for the functional programming meme
>>
>>59405392
Would I compute that in the vertex shader, or somewhere else?

I'm totally down to figure it out myself, I just don't know how it would work. Wouldn't it be best to compute the octree before the fragment shader runs? How would computing such a tree be any cheaper than just doing the rendering, given that tree checks would be executing the same noise checks as the shader?
>>
>>59405284
do coarse culling at the cpu level and rely on the built in gpu-side culling with depth/stencil tests

>Also, is it possible to compile shaders that have early termination for optimization in a reasonable amount of time? Mine always take ages to compile due to all the branches that need to be made.
avoid branches and you can compile a shader binary the first time you load the application which you can then reuse
>>
>>59405405
>"upgrade" it to C++
If it's written in C and works well you'll probably be downgrading it by using C++ constructs. Using C++ requires very careful planning to avoid ending up having a mess.
>>
>>59405422
>he thinks Lisp is just FP
>>
>>59405405
What game?
>>
>>59403615
I want to "step up" my game by doing something I haven't done lately.
Either writing a GUI in Python or C or writing an android app to play with the sensors of my phone.
Unfortunately I don't really know where to start, the last GUI kinda thing I made was dicking around with Irrlicht and MATLAB.
Android studio was just a shitton of files and no clue.
>>
>>59403750
>Reinvent Ocaml's syntax for no reason.
>Name it reason.
Why?
>>
>>59405476
It doesn't really matter when every programming language is just a Lisp in disguise.
>>
>>59405431
Actually you're right, I hadn't thought of the need for the clouds to change. You could try generating a very coarse spatial partitioning structure on the CPU (even something as simple as a 3D grid) and then raycasting on the GPU.

I imagine in practice you also raycast at a much lower resolution that is then scaled up and filtered to your rendering resolution.
>>
>>59405476
The syntax has obvious flaws and inconsistencies (as OCaml fans freely admit). OCaml also lacks top-tier standardized tooling. Basically, it seems like Facebook wants to make a better language as accessible as Go.
>>
>>59405550
>flaws and inconsistencies
Name 3
>>
>>59405440

Lisp's homoiconicity is a fundamental design flaw that doomed it to obscurity in today's programming language market.
>>
>na comes home
>language war shitposting intensifies
>>
>>59405550
>better language
>impure
>>
>>59405646
And Go is pure?
>>
>>59405646
/pol/ and /int/ were right, ban Canada.
>>
>>59405619
I want whatever you are smoking. Then again, nevermind, because you're likely smoking cocks as I type.
>>
File: Better yet still.png (768KB, 972x587px) Image search: [Google]
Better yet still.png
768KB, 972x587px
>>59405500
Durn, so I was right. There's no magic bullet for dynamic volumetric rendering.

I'm currently rendering at a lower resolution and then blitting that onto the screen with trilinear filtering which gives results that are... acceptable, but not quite where I'd like it to be.

Would the optimization from the partitioning structure be from pre-calculating cells where clouds are and aren't , or are you referring to something else?

Sorry for all the questions. The info I can find online is sparse and related to static medical data.
>>
>>59405385
>Ruby has fast development.
This is a pernicious lie. You can write wrong code very quickly in Ruby and Python, however.

>Go has good performance. Not C/++ good, but better than Java or what-have-you.
If it cannot compete with C/C++ performance, then its performance is not good enough. It is far too inexpressive to admit fast development, and the only possible tradeoff that would be worth it is C/C++ performance.

>>59405437
Using a subset of C++ allows you to skip writing a lot of boilerplate that would be necessary in C.

>>59405498
Compile-time checks are important.

>>59405619
Lisp's homoiconicity is the cornerstone of its utility.
>>
>>59405619
And still Lisp is good.
>>
>>59405704
>This is a pernicious lie
No it isn't.
Rails.

>If it cannot compete with C/C++ performance, then its performance is not good enough
That is just flat out fucking retarded.
>>
>>59405605
Okay, Eliezer.
1. ;;
2. Tuples without parentheses
3. let ... in let ... in ... is verbose compare to SML's or Haskell's let syntax
>>
>>59405741
>Rails
Again:
>wrong code
>very quickly

>>If it cannot compete with C/C++ performance, then its performance is not good enough
>That is just flat out fucking retarded.
Not at all. I expect a big prize for giving up expressiveness.
>>
>>59405769
>;;
That's only REPL.
>>59405769
>Tuples without parentheses
Ok but not obvious.
>>
>>59405345
Hey now, go offers fast development and speed if you do it right.
What's with the meme of hating on go and lumping it in with python and ruby? It's far superior in every aspect, the only real complaint about it that I've heard is that it doesn't have proper OOP
>>
>>59405769
>1. ;;
And? Where is the problem?
>2. Tuples without parentheses
And? Where is the problem?
>3. let ... in let ... in ... is verbose compare to SML's or Haskell's let syntax
I don't know for SML. Haskell has let in too, but maybe you're talking about let in do notation.
>>
>>59405802
>That's only REPL.
Right, but if you use the REPL a lot it's a real inconvenience, at least IMO.
>Ok but not obvious.
See the examples for https://facebook.github.io/reason/mlCompared.html#reason-and-ocaml-tuples-and-records.
>>
>>59405849
>Hey now, go offers fast development and speed if you do it right.
No, it doesn't. The language is insufficiently expressive.
>>
File: 02.mp4.webm (2MB, 1920x1080px) Image search: [Google]
02.mp4.webm
2MB, 1920x1080px
Post 1 of 2

In my first semester I had to solder a nice chip which is going to be prgorammed in some module in the 3rd or 4th semester.
Since it is atm just lying around and collecting dust I thought about how to play with it without damaging it.
So I first dumped the flash and read out the apropriate fuses.
Dumping firmware:
sudo avrdude -p atmega8 -c usbasp -U flash:r:flash.bin:r
Read fuses n shit:
sudo avrdude -p atmega8 -p usbasp -v -U lfuse:r:-:i

No we know we have l-fuse of: 0x9f and h-fuse of 0xC8

We then flashed a new chip with the excat same fuses an the firmware:
set fuses:
sudo avrdude -c usbasp -p atmega8 -U lfuse:w:0x9f:m -U hfuse:w:0xc8:m
write the exact flash again:
sudo avrdude -p atmega8 -c usbasp -U flash:w:flash.bin


pic related is before.
>>
>implying a business entity is capable of creating a nonshit programming language
reminder that Ritchie, McCarthy, Stroustrup and Gosling are scientists
>>
>>59405670
>Would the optimization from the partitioning structure be from pre-calculating cells where clouds are and aren't , or are you referring to something else?
Yeah, basically. You'd have 3 cell states - empty, full, and partial. Partial cells would either be subdivided into more cells (like in an octree) or they'd point directly to a chunk of volume data.

I just read this paper about how they did cloud rendering in Horizon: Zero Dawn and they do something quite interesting. The way they generate their clouds is they first take a low frequency noise sample for the shape and then distort it with a high frequency noise sample. They do this in such a way that the resultant clouds are SMALLER than the base cloud shapes. So what they do is ray march at large increments outside of these rough shapes and small increments inside.
>>
>>59405870
I use REPL all the time (utop) and I honestly am never bothered by it, it's like typing ^D at this point.
>>
>>59405870
This language is some serious shit, why not use OCaml at once
>>
>>59405923
Plenty of individuals have created terrible languages.
>>
>>59405916
Post 2 of 2

It then worked with the 'new' atmega8a attached. Which was great, cause now I could start writing my own sketches.
What is the hello world of the embedded worl? Yes, blinking an LED.

Here is my code:
#include <avr/io.h>
#include <util/delay.h>

#define F_CPU 12000000


void ioinit (void);
void beep();

int main (void)
{
DDRB |= (1 << PB4); //PB0 als Ausgang
DDRD |= (1 << PD6);

while(1)
{
beep();
PORTB |= (1 << PB4);
_delay_ms(1000);
PORTB &= ~(1 << PB4);
_delay_ms(1000);
}
}

void beep()
{
int i;
for(i = 0; i < 1024; ++i)
{
PORTD |= (1 << PD6);
_delay_us(300);
PORTD &= ~(1 << PD6);
_delay_us(300);
}
}


now we just gotta compile it to receive our hex file and then just execute the commandline tool from v-usb:

sudo ./bootloadHID file.hex


As I have tried out later the v-usb firmware was apperently exact the one which was on there, because it works, too!
>>
>>59405670
>>59405928
There are also some more basic optimizations you can perform like stopping the ray march once you hit full opacity.
>>
File: 01.mp4.webm (520KB, 1920x1080px) Image search: [Google]
01.mp4.webm
520KB, 1920x1080px
>>59405994
obviously forgot to attach the webm
>>
>>59405923
How do I create a non-shit programming language?
>>
Hello,

I have an exam in a couple of days, what do you guys recommend to study Dynamic Programming and Greedy Algorithms?
I'm a terrible programmer with very limited logical skills.
>>
>>59406086
Create a Lisp dialect.
In fact, just use Lisp.
>>
>>59406092
Install Gentoo.
>>
File: ccc.jpg (30KB, 361x499px) Image search: [Google]
ccc.jpg
30KB, 361x499px
>>59406092
>>
>>59406096
Common Lisp sucks.
Emacs Lisp sucks.
Scheme is useless.
>>
>>59406086
learn Haskell
>>
>>59406115

Use Racket
>>
>>59406086
get a degree in cs
>>
I don't actually believe any criticism against OCaml holds.
>>
>>59406086
Make a dependently typed system language with non-shit syntax.
>>
I have no idea what OCaml is and I think C++, Python, and Javascript cover all use cases.
>>
>>59406115
Use Forth then
>>
>>59406173
Idris?
>>
>>59406176
Javascript only covers bad programmers and bad code
>>
>>59406202
Idris is not a systems language.
>>
>>59405103
Why is python anti-intellectual?
>>
>>59406160
No typeclasses (I know modules are more powerful, but 95% of the time typeclasses are better for working with)
No coherency (because no typeclasses. the merits of coherency are apparently debatable according to some people)
No HKTs
No multithreading
Impure
Non-total
>>
>>59406211
It's the only suitable language for client-side web scripting. You might not consider it a great language, but it's basically the shell script for browsers. You really can't avoid it unless you want to avoid scripting entirely.
>>
>>59406215
Ada?
>>
>>59404818
Did you compile with proper debugging flags?
>>
>>59406092
Design algorithm to find maximum weighted independent set in a tree.
>>
>>59406257
Ada is not dependently typed.

>>59406238
>No typeclasses (I know modules are more powerful, but 95% of the time typeclasses are better for working with)
My programming language will actually unify the concepts.
>>
>>59406252
You should avoid writing it directly as much as possible, though.
>>
>>59406252
Problem is, while Javascript is like bash for browsers, a lot of programmers act like it's assembly for browsers.
Is there really another good client-side scripting language that doesn't have the "compiles-to-JS" meme?
>>
>>59404818
How about trying gdb instead of this "debug50" whatever that is. If only to rule out the debugger.
>>
>>59406298
Well it is ``assembly for browsers" insofar as it's the native language which browsers understand, you really can't have a browser scripting language that DOESN'T compile to JS, without modifying the whole browser with an interpreter for some other language.
>>
>>59406327
That is what I feared most

Still waiting for wasm then
>>
>>59406298
>>59406327
WebAssembly is "out" (but not really useful yet) now, so that will hopefully eventually provide an alternative for at least most of the shit people would have done in JS.
>>
>>59406274
What are the requirements for dependant types?
>>
>>59406347
>>59406356
wasm isn't a full replacement for JS though, is it?
>>
>>59406366
That types can depend on values.
>>
>>59406356
Is there any viable prototypes of wasm running anything on a higher level but shitscript?
>>
>>59406366
Being named Edwin.
>>
>>59406393
No, not really. I can't do DOM manipulation or whatever yet, and still needs JS to actually initialise and run it.
>>
>>59406393
Should be the base for all replacements
>>
What is a garbage collector language generally used for? What kind of problem does it solve?
>>
>>59406366
Something like the code in: http://clhs.lisp.se/Body/m_deftp.htm
>>
>>59406415
This is temporary... right?
>>
>>59406423
It helps prevent memory leaks, by automatically cleaning up objects on the heap that are no longer referenced.
>>
>>59406423
Take a time machine back to 1958 and ask McCarthy yourself.
>>
>>59406366
my_fun : Bool -> Type
my_fun True = String
my_fun False = Float

x : (b : Bool) -> my_fun b
x True = "hello"
x False = 3.4
>>
>>59406426
I don't think it should count if it's dynamic.
>>
>>59406423
It's a mechanism to enable lazy, shitty programmers.

>>59406430
I think so. They just finished their minimum viable product, and are going to add more features over time. I'm pretty sure DOM manipulation and direct execution is on the roadmap.
>>
>>59406430
Nope, a lot of people have a vested interest in JS continuing to be necessary.
>>
>>59406423
Generally used to give programmers the false sensation that they don't need to manage memory
>>
>>59406234
>needing to ask this question
>>
>>59406447
Good thing it doesn't have to be.
>>
>>59406444
Edwin, is that you?
>>
>tfw your c++ games compiles into js on the first try and works decently in browser
holy shit
the magic
>>
>>59406238
>No HKTs
Instant trash. Next time put this first so I don't even have to read the rest.
>>
>>59405297
>Even doing a bunch of string manipulation can cause pythons memory manager to go fucking nuts and eat up GBs of memory
It's actually better than most "script"-like languages because of its more eager, refcount-based garbage collection. I evaluated a couple of them for a little website project, and the Python interpreter was pretty much the only one that used less than 20 MB on startup.
>>
>>59406423
it helps avoid memory leaks and it enables optimization and improved performance vs shitty practices like putting malloc everywhere in C (even in C/C++ you should have your own memory management scheme similar to a garbage collector)
>>
>>59405789
>I expect a big prize
>I
Okay so you're being a subjective retard then
Allow me to counterpoint:

C is too slow and takes too long to develop. If it's not at LEAST as fast as ASM then it's a slow, shitty language.
>>
File: 1489461328707.png (740KB, 1834x1200px) Image search: [Google]
1489461328707.png
740KB, 1834x1200px
>>59405405
>that picture
>>
>>59405255
Python has its problems, but managing large and complex systems is hardly one of them. Or do you have any specific reason for asserting this?
>>
>>59406092
1-0 napsack problem
>>
File: 1485262515835.jpg (76KB, 1065x859px) Image search: [Google]
1485262515835.jpg
76KB, 1065x859px
>>59406489
>it enables optimization and improved performance
You can't honestly believe this.
>>
>>59406474
yeah this is why you don't need ridiculous shitty shit like threejs like anon suggested a while ago
>>
>>59406490
>what is inline assembly
>>
>>59406114
kek, it seems that this is "the only" book one can rely.

Anyway, thanks
>>
>>59406274
Ada has strongly typed dependant types
>>
>>59406458
I'd love for you to show me a Lisp with static dependent types, then. I'll forgive the unavoidable fact that it will look like complete garbage because everything has to be prefix notation.
>>
>>59405385
>Go has good performance. Not C/++ good, but better than Java or what-have-you.
Wtf. If Java has anything at all going for it, it is that Hotspot compiles pretty darned good code. Not C/C++, but there are few other languages that come closer.
>>
>>59406505
a lot of C programmers are delusional as fuck about their programming ability. C/C++ give you the freedom to optimize your shit, but if you write shitty C/C++ it will run like shit.
>>
>>59406500
>Python has its problems, but managing large and complex systems is hardly one of them
This attitude is why we have Docker, and all its assorted problems.
>>
>>59406238
Well, that doesn't contradict my point (on top of more than half of those things existing in OCaml).
>>
>>59405849
>the only real complaint about it that I've heard is that it doesn't have proper OOP
But that's one of its better aspects.
>>
>>59406505
Learn to read.
>vs shitty practices like putting malloc everywhere in C

>>59406518
See >>59406447.
>>
>>59406437
>>59406455
>>59406489
Thank
>>
>>59406464
no
>>
>>59406539
>more than half of those things existing in OCaml
Nope.
>>
>>59406527
>if you write shitty C/C++ it will run like shit
Yes, and?
Is a garbage collector somehow supposed to fix that?
>>
>>59406554
Yes, it makes most codes faster (in general)
>>
>>59406571
Stop. You're embarrassing yourself.
>>
>>59406554
>taking a momentary pause once in a while to invalidate some memory can't be better than constantly allocating and deallocating tiny chunks of dynamic memory
>>
>>59406554
He's right, though. When you allocate through a garbage collector, you're probably not making a system call to do so, and when an object is destroyed, there's no system call there either.

GC is a step up from malloc/free every time you need a piece of heap memory at least.
>>
This is now a bait thread.
>>
>>59406612
You seem to have a naive few of how malloc/free work in modern implementations.

Also, if it's a problem, you can just use your own allocator instead.
>>
>>59406541
Pretty much goalposting
>>
>>59406612
>constantly allocating and deallocating tiny chunks of dynamic memory
Who the hell says you're constantly allocating and deallocating tiny shit?

>>59406630
malloc and free are not system calls.
I don't think you even know how an allocator works.
>>
>>59406645
>Also, if it's a problem, you can just use your own allocator instead.
most hobbyist C programmers don't do this
>>
>>59405668
>>59405704
>>59405727

There are two huge downsides to it:

1. It allows programmers to crawl inside their own asshole with their own abstractions, which is great for expressiveness, but poor if the number of people working on your codebase exceeds one, or if you're trying to create modules for others to use.
2. It shackles the syntax. Lisp programmers are basically stuck looking at what amounts to a visualization of an abstract syntax tree with parenthesis. It's 2017, ALGOL won.

And this third problem doesn't necessarily stem purely from its homoiconicity, but still:

3. "Oh shit, creating a Lisp compiler in Lisp is easy! I'll go write my own, with blackjack and hookers!" *50 years later* "How did we end up with a billion different slightly-incompatible implementations of Lisp?"
>>
>>59406658
>Who the hell says you're constantly allocating and deallocating tiny shit?
People who have no idea how malloc and free are actually implemented.
>>
-Garbage collected programs are often faster. This is counterintuitive, but the reasons are:
>Reference counting is a common solution to solve explicit memory allocation problems. The code to implement the increment and decrement operations whenever assignments are made is one source of slowdown. Hiding it behind smart pointer classes doesn't help the speed. (Reference counting methods are not a general solution anyway, as circular references never get deleted.)
>Destructors are used to deallocate resources acquired by an object. For most classes, this resource is allocated memory. With garbage collection, most destructors then become empty and can be discarded entirely.
>All those destructors freeing memory can become significant when objects are allocated on the stack. For each one, some mechanism must be established so that if an exception happens, the destructors all get called in each frame to release any memory they hold. If the destructors become irrelevant, then there's no need to set up special stack frames to handle exceptions, and the code runs faster.
>Garbage collection kicks in only when memory gets tight. When memory is not tight, the program runs at full speed and does not spend any time tracing and freeing memory.
>Garbage collected programs do not suffer from gradual deterioration due to an accumulation of memory leaks.
>Garbage collectors reclaim unused memory, therefore they do not suffer from "memory leaks" which can cause long running applications to gradually consume more and more memory until they bring down the system. GC programs have longer term stability.
-Garbage collected programs have fewer hard-to-find pointer bugs. This is because there are no dangling references to freed memory. There is no code to explicitly manage memory, hence no bugs in such code.
-Garbage collected programs are faster to develop and debug, because there's no need for developing, debugging, testing, or maintaining the explicit deallocation code.
>>
>>59406680
Rust wins.
>>
>>59406347
>>59406356
Is there actually any advantage to compiling to wasm as opposed to compiling to JS?
>>
>>59406635
>>
File: VID_20170315_002841369.mp4.webm (1MB, 1920x1080px) Image search: [Google]
VID_20170315_002841369.mp4.webm
1MB, 1920x1080px
Works fine now.
>>
>>59406689
Both Rust and C are extremely unproductive.
>>
>>59406680
Multithreading also takes a big performance hit when reference counting is used, because incrementing/decrementing reference counts has to be synchronized.
>>
>>59406635
>This is now a bait thread.
Rust, Go, Python, Java and JavaScript are perfectly decent languages.
>>
>>59406680
You're seriously making a lot of really stupid assumptions.
>>
>>59406718
This is coming from an engineer who made a C++ compiler
>>
>>59406714
>Python, JavaScript are perfectly decent languages
I thought I said "bait thread".
>>
>>59406695
JS is untyped. Anything typed compiled to JS is pretty much just syntactic sugar with no real optimization value
>>
>>59406731
Excellent bait
>>
>>59406727
Lets see it.
Did you manage to solve the halting problem?
>>
>>59406739
Not a bait 2bh. They are also very popular languages
>>
>>59406651
I admit it on a technicality, but at the same time nobody talks about dynamic dependent typing as if there's anything special about it, because there isn't.

The real power of dependent types is to be able to reason mathematically and prove your program to a specification instead of simply being a way of automatically testing everything at run time.
>>
>>59406747
Halting problem is a rare scenario
>>
>>59406748
holy shit stop man i'm cracking up
>>
File: 16634.jpg (24KB, 318x470px) Image search: [Google]
16634.jpg
24KB, 318x470px
>>59406635
>haskell programming
>>
>>59406710
But then garbage collection then gets in the way of every thread during collection.
Anyways, I've heard a lot that reference counting is a really bad form of collection.
However even garbage collection is broad; is it generally faster to do mark & sweep / incremental GC, or copying / generational GC?
>>
Getting ready to sudoku
Port forwarded 15000 for tcp on router
Allowed the executable through firewall (in and out)
Friend did the same
static void Main(string[] args) {
Connect("friend's ipv4 address", "Hello World!");
Console.In.ReadLine();
}

static void Connect(String server, String message) {
try {
Int32 port = 15000;
TcpClient client = new TcpClient(server, port);
Byte[] data = System.Text.Encoding.ASCII.GetBytes(message);
NetworkStream stream = client.GetStream();
stream.Write(data, 0, data.Length);
Console.WriteLine("Sent: {0}", message);
data = new Byte[256];
String responseData = String.Empty;
Int32 bytes = stream.Read(data, 0, data.Length);
responseData = System.Text.Encoding.ASCII.GetString(data, 0, bytes);
Console.WriteLine("Received: {0}", responseData);
stream.Close();
client.Close();
}
catch (ArgumentNullException e) {
Console.WriteLine("ArgumentNullException: {0}", e);
}
catch (SocketException e) {
Console.WriteLine("SocketException: {0}", e);
}

Console.WriteLine("\n Press Enter to continue...");
Console.Read();
}

This shit just sits there trying to connect and then crashes saying
>"there ain't been no response boss"
>>
>>59406680
>All those destructors freeing memory can become significant when objects are allocated on the stack. For each one, some mechanism must be established so that if an exception happens, the destructors all get called in each frame to release any memory they hold. If the destructors become irrelevant, then there's no need to set up special stack frames to handle exceptions, and the code runs faster.
DWARF/Itanium exception handling nigger, look it up.
>>
>>59406766
what do you mean?
>>
>>59406762
So? Parsing that shitlang is still undecidable.
>>
>>59406704
>tfw never touched hardware
that looks really cool anon
>>
>>59406773
>exception handling
that's definitely not 'c'
>>
>>59406748
They may well be popular, they're still shit.

>>59406751
This. Same reason nobody gets excited about people implementing stuff from statically typed languages in Lisp, we know you can do it, but the point (which is being missed) is to catch problems at compile time.
>>
>>59406751
It's hard to create an efficient runtime that uses dynamic dependent types (e.g. existential quantification)
>>
>>59406751
That's what Spark is for
>>
>>59406807
>they're still shit.
If they were, people would not be using them.
>>
>>59406680
>>59406773
Also, garbage collected languages have their own kind of memory leak, where an object is reachable but never used.
>>
>>59406811
put the burden on the programmer
>>
>>59406817
That's not how it works, anon.

>>59406812
No, spark is a memetech.
>>
>>59406827
Why do you not JS, Python and Java?
>>
>>59406817
>If they were, people would not be using them.
Why? People do shitty and stupid things all of the time, even on scale.
>>
>>59406811
Well, yeah, RTTI is extremely inefficient. What's your point, that Ada is special for making their automatic defensive programming slightly less inefficient than other languages?
>>
>>59406819
Go doesn't have this problem
>>
>>59406827
>Calling the thing you just wanted memetech
Ok
>>
>>59406831
>Why do you not JS, Python and Java?
Because they're utter fucking garbage?
>>
>>59406819
This kind of thing would happen in a managed language too, unless you're prematurely freeing things
>>
PHP is about as exciting as your toothbrush. You use it every day, it does the job, it is a simple tool, so what? Who would want to read about toothbrushes?
>>
>>59406834
>People do shitty and stupid things all of the time
You don't?
>>59406847
So you are saying if they were decent you would use them?
>>
>>59406505
There's a classic academic paper (that I can't find right now) which proves mathematically that garbage-collected memory management can reach levels of performance that are impossible for explicit memory allocators, since the GC can do batch passes over all dead data. Also, you have to keep in mind that allocation in a GC'd system is as fast as stack allocation.

It does give uneven performance, which may well be bad for real-time systems or games, but that's a different question.
>>
>>59406845
I'm not that guy

>>59406844
Go's only problem is being unusable for writing code.

>>59406842
>>59406811
Types should be erased at runtime. Do all the checking, proving, etc. at compile time.

Type erasure is one thing Java got less wrong than C#.
>>
>>59406812
Spark is just Ada with more discipline. It's not static dependent types, it's still contracts that are asserted at run time.
>>
>>59406531
That is of course not to say that you cannot write bad programs in Python, but that goes for literally every language.
>>
>>59406844

Horseshit. Any garbage-collected language has this problem.
>>
>>59406867
>You don't?
Did I imply that I am not a person?
>>
>>59406884
>Go's only problem is being unusable
For you maybe
>>
>>59406874
this
>>
>>59406874
Which is great, but this only applies in certain areas. Garbage collection should be implemented with regional allocators, not as a global, unavoidable process.
>>
>>59406874
>allocation in a GC'd system is as fast as stack allocation
That honestly makes no fucking sense, unless you're being stupidly reckless with your memory and NEVER reusing it.
>>
>>59406887
Ada is contacts asserted at runtime
Spark is statically proved, so no need for checks at runtime.
>>
>>59406867
>So you are saying if they were decent you would use them?
Yeah. I don't think that's controversial.

They're never going to be decent, though.

>>59406874
You can write a custom allocator that does things in batches, you know.
>>
>>59406680
Holy shit bro do you expect me to read all that shit
>>
>>59406894
No, you are right, people like you do stupid shit all the time. At last the majority of people aren't as stupid as you.
>>
>>59406916
>>So you are saying if they were decent you would use them?
>Yeah.
Most people use it because they found them to be decent. You are an irrelevant outlier.
>>
>>59406914
In both stack allocation and GC'd allocation, the act of allocating is just adjusting a pointer for the size of the object allocated.
>>
>>59406934
>Most people use it because they found them to be decent.
Most people have extremely poor taste and judgment.
>>
>>59406916
>You can write a custom allocator that does things in batches, you know.
You can amortize some operations, but not all.You will at the very least have to maintain some kind of list or other data structure of the freed chunks to process later.
>>
>>59406914
It has to do with the traditional implementation of a moving collector where allocations come from a single region, and allocation is just incrementing the region pointer. This is always going to be faster that malloc(), which is NOT necessarily even O(1) as it is easy assume.
A moving collector also doesn't fragment memory
>>
>>59406953
As opposed to the state the garbage collector must maintain if it's to have any hope of performing well?
>>
>>59406936
That's not the sort of runtime efficiency people aim for with manual allocation. It's about space vs time trade off. Otherwise you can just allocation a huge frame and never reuse it, boom, infinite performance.
>>
>>59406936
>the act of allocating is just adjusting a pointer for the size of the object allocated
Yes, I know. Now once your objects are free, there are going to be massive fragmentation. You can only move the pointer back once you know that all of the objects can safely be freed, which might NEVER happen.
It's not like you can shuffle shit around either, as you would have to go an change all of the pointers in your program.
>>
>>59406972
Yes, since it only has to touch that state when freeing stuff.
>>
anyone here work freelance? are there any platforms like upwork that are not complete shit?
>>
>>59406952
Or maybe it's you who can't adopt to different things and end up being an angry manlet in /dpt/
>>
>>59406456
Not an argument

>>59406474
>compiling sepples into JS
I would not want to see that JS code

>>59406571
>codes
Hi Pajeet

>>59406612
>xe doesn't know how to use the stack

>>59406630
GC only handles deallocation, heap allocation has to be done the same way under the hood as malloc(). GC is really only worthwhile on programs complex enough that determining object lifetimes at compile time is difficult.

>>59406658
Aren't malloc and free usually implemented in terms of system calls?

>>59406659
Because malloc() is adequate for most purposes.

>>59406689
Rust doesn't have garbage collection. It uses a form of reference counting in which there can only be a single "strong" reference to a given object, and when that reference is destroyed (either by going out of scope, in the case of stack-allocated references, or by being part of another object that is destroyed) the object is deallocated.
>>
>>59406990
>Or maybe it's you who can't adopt to different things and end up being an angry manlet in /dpt/
No, I actually started out with shitlangs, then I learned better ones and now I refuse to go back.
>>
>>59406993
>>codes
>Hi Pajeet
Sorry he didn't say "standalone system executable binaries"
>>
>>59406979
Please educate yourself before arguing
https://en.m.wikipedia.org/wiki/Cheney's_algorithm
>>
>>59406993
>Aren't malloc and free usually implemented in terms of system calls?
No. They might use a system call every now and then, but it is not synonymous with a system call.
With the glibc allocator, it will call brk/sbrk or whatever when the heap runs out of space, and mmap for particularly large allocations.
>>
>>59406915
Okay, I read a bit more on SPARK but it's not dependent types as the "values" depended on have to be compile time constants.
>>
Lets rewrite the Java Virtual Machine but better

How do we accomplish this programming gods of /dpt/ ?
>>
I'm bored as fuck and I want to make more money, I have a fulltime job developing (full stack), but I want _more_.
>>
>>59406979
>It's not like you can shuffle shit around either, as you would have to go an change all of the pointers in your program.
Ever heard of copying GCs? Pretty much any GCd language implementation (including, but not limited to Hotspot and SBCL) use them. Since they have information about the data layouts used in the program, updating the pointers isn't a problem.
>>
>>59406993
>Aren't malloc and free usually implemented in terms of system calls?
sbrk and mmap mostly, but you usually don't relinquish pages with negative sbrk.
>>
>>59406993
>Aren't malloc and free usually implemented in terms of system calls?
Why would you think a call to either of them always results in a syscall?
>>
>>59407006
>I actually started out with shitlangs
In which you failed miserably. Now you grasp onto anything different to convince yourself that you can learn different things.
>>
>>59406978
>It's about space vs time trade off.
So you're agreeing that GCd systems use more memory (between collections) in return for higher speed?
>>
>>59407017
> programming gods of /dpt/ ?
You mean pseudo coding gods of /dpt/
>>
>>59406993
>Rust doesn't have garbage collection. It uses a form of reference counting in which there can only be a single "strong" reference to a given object, and when that reference is destroyed (either by going out of scope, in the case of stack-allocated references, or by being part of another object that is destroyed) the object is deallocated.
Which is why I said it wins. It's not garbage collected but it also doesn't suffer from most of the problems listed.
>>
>>59407017
>Lets rewrite the Java Virtual Machine but better
What would you improve on it? Hotspot is pretty good.
>>
>>59407042
I agree that GC is a rather inefficient way to trade time and space for safety and comfort/ease of development (which is not a bad thing).
>>
>>59407055
RUST
IS
HARD
IT'S
BATSHIT
INSANE

EOF
>>
>>59407062
The very point is that you don't trade away runtime speed by using garbage collection, doe.
>>
>>59407039
>In which you failed miserably
I made good money using shitlangs professionally for years.
>>
>>59407069
>don't trade away runtime speed by using garbage collection
Ignoring the fact that the fucking garbage collector has to run and perform a shitload of copying.
>>
>>59407060
you guys all complain it is shit and Java is shit in general etc
>>
>>59407077
That fact is of course accounted for in the paper referred to by >>59406874
>>
>>59407090
We dislike Java the language.
>>
>>59407055
It does RAII, just with the possibility of not having to destruct 'moved' objects. It also is able to statically prevent dangling pointers.
It's basically just a safer version of C++'s semantics, so it suffers much of the same faults. In fact, most of the time when it avoids calling destructors, the C++ compiler would optimize the destructor out anyways. So Rust will be marginally faster than C++ at best (in theory; C++ has some practical problems actually)
>>
People are forking sublime text in Golang. It's called limetext. You should contribute to it if you have time otherwise it'll stay dead.
Limetext is compatible with sublime text's plugin system.
>>
>>59407090
Yes, Java is crap. The JVM, however, is far less crappy.
>>
>>59407076
And how much are you making now with your newfound languages?
>>
>>59407101
No. The fewer projects written in languages like Go and Python, the better.
>>
>>59407101
>You should contribute to it if you have time otherwise it'll stay dead.
I'm okay with this.
>>
>>59407121
Stop using python then
>>
File: em.png (33KB, 658x380px) Image search: [Google]
em.png
33KB, 658x380px
>>59406993
yeah, it's strange
but it works
>>
>>59407131
I don't use Python.
>>
>>59407135
>how to kill every anon ITT's eyes
>>
>>59407138
If you are using Linux/*BSD there is a high possibility that your system uses python
>>
>>59407099
The only point that still applies to Rust is this:
>Destructors are used to deallocate resources acquired by an object. For most classes, this resource is allocated memory. With garbage collection, most destructors then become empty and can be discarded entirely.
Which is definitely true because the Rust standard library and thus basically all libraries have no custom allocator support yet. But it's a pretty minor one.
>>
>>59406714
>Rust
Still too soon if it will be a credible replacement to C/C++
>Go
No generics, shitty syntax, doesn't seem to have any real advantage over C.
>Python
Good for quick stuff, and as a cross-platform tool for batch scripting. Basically the BASIC of the 21st century.
>Java
Decent for cross-platform application development, syntax is nicer than that of C++ but its library is full of enterprise OOP bloat.
>JavaScript
Only real choice for web scripting

>>59406736
WASM is typed?

>>59406806
C doesn't have 'destructors', either, genius

>>59406936
That's true on machines without memory protection. But A) it's not 1986 anymore and B) without memory protection, a call to malloc() would also be "just adjusting a pointer" if it wasn't for memory protection, so GC would have no advantage over M3 on the allocation side.
>>
File: evil-3.jpg (85KB, 1280x720px) Image search: [Google]
evil-3.jpg
85KB, 1280x720px
>>59407135
>>
>>59407156
>Good for quick stuff, and as a cross-platform tool for batch scripting.
No.
>>
>>59407156
>doesn't seem to have any real advantage over C.
Built-in coroutines is pretty nice.
>>
D is made my Walter Bright and Alexandrescu, hence D is destined to success.
>>
>>59407167
Far better than C in that case
>>
New thread:
>>59407179
>>59407179
>>59407179
>>
>>59407175
Yes, any day now. 2017 will be the year of the D desktop.

D is dead, anon.
>>
>>59407175
>Alexandrescu
Thanks to him, D is a slightly simpler version of C++. D1 used to be a very nice language making C somewhat usable
>>
>>59407156
>without memory protection, a call to malloc() would also be "just adjusting a pointer" if it wasn't for memory protection
Do you know anything about allocators? They are fucking complicated, has nothing to do with "memory protection"
>>
>>59407187
And may it rest in peace. It never deserved the name.
>>
>>59407156
>That's true on machines without memory protection.
What are you talking about. malloc() has to have a way to find unused memory on the heap, and it has nothing at all with memory protection to do.
>>
>>59407015
And how big is the heap upon program entry?

>>59407030
Where exactly did I say that? I myself have written a standard-conforming malloc() implementation that NEVER uses system calls. But that's not how most C libraries do it.

>>59407096
And GC is orthagonal to "explicit memory allocators".
>>
>>59407167
Care to explain why?
>>
>>59407228
>I myself
>>
>>59407228
>And how big is the heap upon program entry?
Zero bytes. Malloc brk()s in a large amount the first time it's called.

>And GC is orthagonal to "explicit memory allocators".
Of course you could implement malloc() to be gcalloc() and free() to be NOP, but that's a different comparison.
>>
>>59407264
>Zero bytes. Malloc brk()s in a large amount the first time it's called.
So then by definition EVERY program which calls malloc() is going to use the system calls within malloc.
>>
>>59407284
Nobody said it doesn't ever use a syscall, it's just that it doesn't always use a syscall.
Even your shitty GC or whatever you're arguing for is going to need to call brk/sbrk for some heap space.
>>
>>59407316
It doesn't call syscalls EVERY time (and I never said it did) but that in common implementations of malloc(), the syscalls are a FUNDAMENTAL PART of the implementation.
>>
>>59407337
And so they are of a garbage collected allocator.
>>
>>59407337
>the syscalls are a FUNDAMENTAL PART of the implementation.
Not on single-process systems. :^)
>>
>>59407393
That's why I said "in common implementations".
>>
>>59406176
>I have no idea what _ is and I think _ cover all use cases.
They wrote this one for you: http://wiki.c2.com/?BlubParadox
>>
>>59407156
Wasm is a way to implement real types
>>
>>59405112
Thank you!
>>
>>59403615
Which Scheme is better? Should I go with Racket or Guile?
Thread posts: 351
Thread images: 24


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