[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: 320
Thread images: 35

File: dpt_flat.png (102KB, 1000x1071px) Image search: [Google]
dpt_flat.png
102KB, 1000x1071px
Old thread: >>61526805

What are you working on, /g/?
>>
>>61531837
Working on a roguelike, just started. Feel like I'm stressing too much about the architecture but I don't want to regret choices later.
>>
2nd for Tk
>>
Trying to decide between using Scheme and Idris for making a game
>>
>>61531876

Scheme more practical.
>>
>>61531876
There was a big lisp-vs-haskell debate in the previous thread, you might be interested
>>
File: g projects.png (378KB, 1450x1080px) Image search: [Google]
g projects.png
378KB, 1450x1080px
rolling for one of these cause i'm bored
>>
I couldnt wrap my tiny brain around postfix notation until I wrote in FORTH.
Thanks, FORTH.
>>
>>61531837
I hate programming more and more every day.
>>
>>61531939
What languages/libraries/tools are you using? Can you try different ones?
>>
>>61531911
Thanks, I guessed that, but no static typechecking makes me super uncomfy and nervous.
>>
>>61531939
Stop using languages and libraries that are a net pain in the ass. Stop working as a code monkey. Work on different projects. Stop programming for a while, stop programming forever.

Etc.
>>
>>61531837
I start an HPC workshop this week so I'm brushing up on my C.
>>
>>61531939
The only time I genuinely hate programming is
A) Working in Java for just about anything. It's just a flat out unpleasant language to work in and the lack of pointer manipulation in an OOP language is fucking obnoxious.
B) Working in Python, because it's too easy to break the entire program on a syntax error that's reported 50 lines after the fact
>>
>>61532005
>Working in Python, because it's too easy to break the entire program on a syntax error that's reported 50 lines after the fact
Do you get that with other dynamic languages too?
>>
>>61532022
No, because including an extra space on a line doesn't cause the program to explode.
>>
>>61532028
Oh, yeah. I'd forgotten Python did that.
>>
>>61531965
Use OCaml. It's very practical.
>>
>>61531921
rollan for an easy one
>>
>>61531876
My minecraft clone uses Scheme.

>>61531965
It's not a big deal since you don't have to compile it. There's no implicit conversion so you don't have to deal with subtle bugs like you do in Javascript or PHP.
>>
>>61531921
roll
>>
>>61532028
Never worked with python. You mean something like including an extra space at the end of the line, or between commands, outright breaks a program?
>>
>>61532064
what exactly am I expected to make
it's an interesting law, but what's to be done with it in terms of programming?
re-roll
>>
>>61532076
Python uses Whitespace as part of its syntax, so if you're not paying attention and accidentally brush the space bar you can unexpectedly fuck everything up, and about half the time it's really bad at reporting what line has the mystery space on it.
It's the only language I know of where having leading "whitespace marks" like you'd see in a Word document is useful.
>>
>>61532098
Out of curiosity how does python handle spaces vs tabs? I use a tabstop of 2 and sometimes mix spaces in, even when I write C code.
>>
>>61532098
Sounds worse than batch's handling of if / else and parenthesis.
>>
>>61532109
https://www.python.org/dev/peps/pep-0008/#tabs-or-spaces
Officially you're supposed to use spaces (which is a terrible, terrible idea)
In v3 mixing them will break the program completely
In v2 it's allowed, but you will constantly fuck yourself in the ass doing so.
Basically its fucked up and whatever editor you're using you should have it auto-replace tabs to spaces or vice versa.

>>61532111
For what god-forsaken purpose are you still using batch scripts
>>
>>61531911
Ruby, will you still be able to browse 4chan when you do your PhD?
>>
>>61532055
>no unsigned type
>no native threads
>>
Rate my kode:
define : factorial n
__ if : zero? n
____ . 1
____ * n : factorial (- n 1)

display : factorial 5
newline

https://srfi.schemers.org/srfi-119/srfi-119.html

>>61532162
>Officially you're supposed to use spaces
>In v3 mixing them will break the program completely
Ewwwwwww.

So say you have a function with a lot of arguments, do you just have to let it word wrap rather than part of it go on a new line?
>>
>>61532205
disgusting
>>
>>61532177

To some extent, yes. I try to allocate some time out of my day where I do nothing productive and just veg.
>>
>>61532205
>do you just have to let it word wrap rather than part of it go on a new line
Oh that's the best part. The official spec is to limit all line length to a maximum of 79 characters.
And there isn't any defined way to handle line continuation, so you get

if (this_is_one_thing and
that_is_another_thing):
do_something()

or
if (this_is_one_thing
and that_is_another_thing):
do_something()

or even
with open('/path/to/some/file/you/want/to/read') as file_1, \
open('/path/to/some/file/being/written', 'w') as file_2:
file_2.write(file_1.read())


What lines are part of the previous statement and which are the actual next times? Who the fuck knows! We chose the worst syntax structure imaginable!
>>
>>61532005
>Working in Java for just about anything
This so much. Java is one of the worst languages I ever had the displeasure to learn. Any time I had to write code in it, my desire to program diminished further and further.
>>
>>61532249
Java 8 is a significant step up from 7 and earlier, but it's still much less nice than many other languages.

I wish programmers had refused this shit from the beginning. Lisp was robbed, ML was robbed, and now we're stuck with tedious, mediocre garbage.
>>
>>61532162
>For what god-forsaken purpose are you still using batch scripts
I was once inspired by a batch script, and therefore wrote my own version in batch. Although I try to tell myself there can be freedom and ease in greater limitation, I often ask myself the same question.

It's a file optimizer script, and pretty solid though. The best I know of, that's publicly available anyway. It's sitting on a hard drive I don't feel like gaining access to (no machine that has SATA ports). I might do a bash rewrite eventually.
>>
>>61532321
>I wish programmers had refused this shit from the beginning
The people who adopted it were the ones looking to crank out an application fast and cheap. Java was a huge pioneer in what it started because you didnt have to worry about memory safety and it was pretty dang easy to write comparatively speaking.
The only reason it's still used now is because of JVM portability, but hopefully that'll slowly die off with some help from LLVM and the CRE from MS.
C# isn't nearly as fast as Java is right now, but it basically fixes every aspect of Java that makes it so goddamn unbearable to work with (Including an unsafe block that allows pointer manipulation)
>>
>>61531911
What did you do your masters in? I'm looking at starting some graduate work but I'm still unclear on the whole process and how people select a thesis topic and whatnot.
>>
>>61532370
>Java was a huge pioneer in what it started because you didnt have to worry about memory safety and it was pretty dang easy to write comparatively speaking.
I think Lisp had both of those qualities way before Java did.

>C# ... basically fixes every aspect of Java that makes it so goddamn unbearable to work with
I disagree. C# is still boilerplate heavy and not very amenable to non-trivial abstraction.
>>
>>61531867
How do you generate the maps?
>>
>>61531911
This

>>61531965
Are there external static typecheckers?
>>
>>61532399
I'm pretty sure it's in Hospitality and Tourism.
>>
>>61532472
Java allowed for GUI's to be made easily, OOP was popular at the time, and it was shilled hard by a large company (Oracle).

Meanwhile Lisp had lost ground on AI, and nobody really cared about popularizing it.
>>
>>61532472
>Lisp
Maybe, but lots of theoretically-great languages don't catch on for a lot of reasons. Java is much more "friendly" to write to most people.

>C# is still boilerplate heavy
In the sense of you still have shit like
public int num { get; set; }
public int num2 { get; set; }
public List<int> list = new List<>();
public static void main(string args[]) { //blah }

Then sure. But it has waaaaay more compact accessors and implementation/inheritance systems.

>and not very amenable to non-trivial abstraction
explain
>>
>>61532510
>shilled hard by a large company (Oracle).
Ah, of course.
>>
>>61532510
It was shilled by Sun. Sun got bought out after Java became big.
>>
>>61532085
did it twice for shit's and giggles

(define (slowfib x)
(cond ((= x 0) 0)
((= x 1) 1)
(else (+ (slowfib (- x 1)) (slowfib (- x 2))))))

(define (fastfib n)
(let ((x 0) ;return value
(z 0) ;fib of x-1
(t 0) ;temp value
(c 0)) ;counter
(fastfib-helper n x z t c)))

(define (fastfib-helper n x z t c)
(if (= x 0)
(begin
(set! x 1)
(set! c (+ 1 c))
(fastfib-helper n x z t c))
(if (not (= c n))
(begin
(set! t z)
(set! z x)
(set! x (+ t x))
(set! c (+ 1 c))
(fastfib-helper n x z t c))
x)))


scheme@(guile-user)> (fastfib 10)
$8 = 55
scheme@(guile-user)> (fastfib 100)
$9 = 354224848179261915075
>>
>>61532473
Not really worrying about that yet. My focus on this project is trying to make a good planning based AI since that's what I feel like is the only unique thing I might be able to offer.

It might even be mostly a fixed overworld where the focus is on interacting with NPCs.
>>
>>61532629
What are your ideas?
>>
Stylizing some code for a presentation
>>
>>61532648
nice
>>
>>61532640
Essentially I'm trying to make a variation of a STRIPS-style planner that uses a utility function rather than goal states. It's basically going to be a best-first search on a graph of state transitions where the edges are actions... I think. But I'm not sure. The goal is to only use planning on higher level things in a hierarchy and then do lower-level stuff like pathfinding in a more or less hard-coded fashion (but the results of pathfinding might factor into costs on the graph).

Kind of hazy at the moment, but I'm going to stop worrying about planning the whole thing before I have any code written, and start writing the basics every roguelike needs and work from there.
>>
File: confused.jpg (39KB, 374x347px) Image search: [Google]
confused.jpg
39KB, 374x347px
>>61532648
> <body>
Is that html?
>>
>>61531921
Wow I suck at this
#include <stdio.h>
#include <stdlib.h>

#define POINT_A1 6, 1
#define POINT_A2 4, 5
#define POINT_B1 2, 0
#define POINT_B2 3, 2


typedef struct {
int x, y;
} Point;

typedef struct {
Point a, b, c, d;
} Rectangle;

Rectangle newRectangle(const Point a, const Point c) {
Rectangle out;
out.a = a;
out.b = (Point) { a.x, c.y };
out.c = c;
out.d = (Point) { c.x, a.y };
return out;
}

Point *getDiagonal(const Rectangle r) {
Point *out = malloc(2*sizeof(Point));
if (r.a.x < r.c.x) {
if (r.a.y < r.c.y) {
out[0] = r.a;
out[1] = r.c;
} else {
out[0] = r.b;
out[1] = r.d;
}
} else {
if (r.a.y < r.c.y) {
out[0] = r.d;
out[1] = r.b;
} else {
out[0] = r.c;
out[1] = r.a;
}
}
return out;
}

int main () {
Rectangle a_Rectangle = newRectangle((Point) { POINT_A1 }, (Point) { POINT_A2 });
Rectangle b_Rectangle = newRectangle((Point) { POINT_B1 }, (Point) { POINT_B2 });

Point *a_Diag = getDiagonal(a_Rectangle);
Point *b_Diag = getDiagonal(b_Rectangle);

if ( a_Diag[0].x > b_Diag[1].x ||
a_Diag[0].y > b_Diag[1].y ||
a_Diag[1].x < b_Diag[0].x ||
a_Diag[1].x < b_Diag[0].x ) {
printf("The two rectangles don't overlap.\n");
return EXIT_SUCCESS;
}
printf("The following points define the diagonal line of the overlapping rectangle:\n");
printf("( %d, %d ) ( %d, %d )\n",
a_Diag[0].x > b_Diag[0].x ? a_Diag[0].x : b_Diag[0].x,
a_Diag[0].y > b_Diag[0].y ? a_Diag[0].y : b_Diag[0].y,
a_Diag[1].x < b_Diag[1].x ? a_Diag[1].x : b_Diag[1].x,
a_Diag[1].y < b_Diag[1].y ? a_Diag[1].y : b_Diag[1].y);

free(a_Diag);
free(b_Diag);
return EXIT_SUCCESS;
}
>>
>>61532783
Holy shit how did it not occur to me that it looks like HTML... this is bad ...
>>
>>61531921
rolling for gf
>>
>>61532828
>4 points to define a rectangle
You can easily do it in 2.
>>
>>61532888
Rectangle newRectangle(const Point a, const Point c) {


???
>>
>>61532911
Yes, but the actual definition still has 4.
>>
>>61532618
Now do it with lazy infinite recursion (delay and force).
>>
>>61532974
I'm a plebeian when it comes to scheme and I understand none of what you want me to do
>>
>>61532888
>>61532918
Eh, it's a simple enough change I suppose
#include <stdio.h>
#include <stdlib.h>

#define POINT_A1 6, 1
#define POINT_A2 4, 5
#define POINT_B1 2, 0
#define POINT_B2 3, 2


typedef struct {
int x, y;
} Point;

typedef struct {
Point a, c;
} Rectangle;

Point *getDiagonal(const Rectangle r) {
Point *out = malloc(2*sizeof(Point));
if (r.a.x < r.c.x) {
if (r.a.y < r.c.y) {
out[0] = r.a;
out[1] = r.c;
} else {
out[0] = (Point) { r.a.x, r.c.y };
out[1] = (Point) { r.c.x, r.a.y };
}
} else {
if (r.a.y < r.c.y) {
out[0] = (Point) { r.c.x, r.a.y };
out[1] = (Point) { r.a.x, r.c.y };
} else {
out[0] = r.c;
out[1] = r.a;
}
}
return out;
}

int main () {
Rectangle a_Rectangle = (Rectangle) { (Point) { POINT_A1 }, (Point) { POINT_A2 } };
Rectangle b_Rectangle = (Rectangle) { (Point) { POINT_B1 }, (Point) { POINT_B2 } };

Point *a_Diag = getDiagonal(a_Rectangle);
Point *b_Diag = getDiagonal(b_Rectangle);

if ( a_Diag[0].x > b_Diag[1].x ||
a_Diag[0].y > b_Diag[1].y ||
a_Diag[1].x < b_Diag[0].x ||
a_Diag[1].x < b_Diag[0].x ) {
printf("The two rectangles don't overlap.\n");
return EXIT_SUCCESS;
}
printf("The following points define the diagonal line of the overlapping rectangle:\n");
printf("( %d, %d ) ( %d, %d )\n",
a_Diag[0].x > b_Diag[0].x ? a_Diag[0].x : b_Diag[0].x,
a_Diag[0].y > b_Diag[0].y ? a_Diag[0].y : b_Diag[0].y,
a_Diag[1].x < b_Diag[1].x ? a_Diag[1].x : b_Diag[1].x,
a_Diag[1].y < b_Diag[1].y ? a_Diag[1].y : b_Diag[1].y);

free(a_Diag);
free(b_Diag);
return EXIT_SUCCESS;
}
>>
>>61532974
#lang racket

(define (in-fibs [a 1] [b 0])
(stream-cons a (in-fibs (+ a b) a)))

(for ([i (in-range 30)]
[f (in-fibs)])
(printf "fib #~a = ~a\n"
(add1 i)
f))


>>61532618
Negro why do you have so many variables and why are you using set! everywhere?
>>
>>61531837
Can you guys tell me what's the most effective way to learn data structures and algorithms? What are some good resources for a beginner?
>>
>>61533022
>Negro why do you have so many variables and why are you using set! everywhere?
I have no idea what I'm doing desu senpai
>>
It was fun to see peoples solutions last time, so:

Given an integer input, print the following shapes:
*   *
* *
*
* *
* *


* ***
* *
* *
*****
* *
* *
*** *
>>
>>61533055
and do what with the input?
>>
>>61533031
CLRS is a good book
>>
>>61533055
This dumb. What does the integer signify? Does 0 mean to print the X and 1 mean print the 卐?
>>
>>61533066
>>61533055
If the input was 5, those shapes would be printed like that.
If it were 7, it would print the same shapes at a different size.
>>
>>61533124
I've looked at that one and it has mathematical notation which I can't understand, though if you could point me in the right direction as to where I could start understanding it, it'd be much appreciated.
>>
Anyone know how i can map out the memory of a running program in windows using c++ do I use readprocessmemory or? Also I need to map a program that isn't mine
>>
>>61533162
> it has mathematical notation which I can't understand
Take some calculus courses, summation is very very important in algorithms.
>>
>>61533066
kek


>>61533131
out1 = ["*   *\n * *\n  *\n * *\n*   *","* ***\n* *\n* *\n*****\n  * *\n  * *\n*** *"]
out2 = ["* *\n * *\n * *\n *\n * *\n * *\n* *", "* *****\n* *\n* *\n* *\n**********\n * *\n * *\n * *\n****** *"]

main = do
i <- readLn
mapM_ print (if i == (5 :: Int) then out1 else out2)
>>
>>61533162
>mathematical notation
Are you talking about big-O notation?
>>
>>61533192
whoops, that should be

mapM_ putStrLn
>>
>>61532247
B-but look how pretty fizzbuzz is Anon! /s
>>
>>61533212
say "Fizz"x!($_%3)."Buzz"x!($_%5)||$_ for 1..100

Perl shits on python.
>>
>>61533197
No, I looked on the inside of it and it had some sigmas and some other shit thrown in there I know nothing about.

>>61533183
Never got to calculus, but I'll work my way up and wrap my head around it, guess I have to, does it have to be advanced calculus? Thank you for the reply too, even if I'm only being able to get a sense of direction it helps alot!
>>
>>61533230
>pretty
>>
>>61532982
Delay and force are ways of making and getting so called promises. Basically packing data into a promise means you won't evaluate it until you "force".

Delay can be a macro that converts
(delay x)

to
(lambda () x)


And force can be a macro that converts
(force x)

to
(x)

If you define a macro stream-cons to convert
(stream-cons a b)

to
(cons a (delay b))

defined as
(define-syntax stream-cons (syntax-rules () ((_ a b) (cons a (delay b)))))

And a function stream-cdr:
(define (stream-cdr stream) (force (cdr stream)))
(define (stream-ref stream n) (cond ((= n 0) (car stream)) (else (stream-ref (stream-cdr stream) (- n 1)))))

You can create infinite lists like so:
(define ones (stream-cons 1 ones)
(stream-ref ones 1000) ;=> 1
>>
>>61532399

Computer Science. My research was in cybersecurity. Your thesis topic is something you'll probably end up deciding with your advisor. To get into grad school, you just need good letters of recommendation and good GRE scores. Once there, whatever you need help on, talk to your advisor about.
>>
>>61533240
>advanced calculus
Ehhh, not really. Vector calculus and multivariable dont really play into CS too much.
The important part is understanding and recognizing Summation patterns and how to manipulate them for calculations, and understanding how derivatives and integrals work.
>>
>>61533240
https://en.wikipedia.org/wiki/Summation#Capital-sigma_notation
>>
>>61532762
Sounds awesome desu, good luck and keep us updated!
>>
>>61533249
Rubester, which languages did you do in undergrad?
>>
>>61533245
what the hell
i've got a long way to go in learning scheme it seems
>>
>>61533257
Just one more thing, is lambda calculus related? Like if I did the little schemer would that help?
>>
File: old_hag_langs.png (173KB, 600x355px) Image search: [Google]
old_hag_langs.png
173KB, 600x355px
>you're LITERALLY posting on the same thread as the people who doesn't know sigma summation notation
>these are the people that are giving you programming advice
Truly shocked.
>>
>>61533285
It's very useful to learn for a lot of functional languages or even lambda functions in OOP languages like C# (LINQ), Ruby (do blocks), or Java (lambda expressions)
>>
>>61533287
Everyone has to start at the beginning.

You did too at one point.
>>
#lang racket

(define ((shape f) n)
(for ([y (in-range n)])
(for ([x (in-range n)])
(display (if (f x y n)
#\*
#\space)))
(newline)))

(define-syntax-rule (define-shape (name . args)
body ...)
(define name
(shape (λ args body ...))))

(define-shape (cross x y n)
(or (= x y)
(= x (- n y 1))))

(define-shape (swastika x y n)
(define n/2 (quotient n 2))
(define n-1 (- n 1))
(or (= x n/2)
(= y n/2)
(and (< x n/2) (= y n-1))
(and (> x n/2) (= y 0))
(and (< y n/2) (= x 0))
(and (> y n/2) (= x n-1))))

(cross 13)
(newline)
(swastika 9)
>>
File: older-hags.png (176KB, 600x309px) Image search: [Google]
older-hags.png
176KB, 600x309px
>>61533287
>ah, that picture again
Have the proper old hags once again, dear Anon.
>>
File: test.webm (3MB, 796x600px) Image search: [Google]
test.webm
3MB, 796x600px
I worked on feeding the output of a compute shader into a regular vertex-fragment pipeline shader, to make a simple particle system. I made a compromise, which is not receiving the output of the compute shader CPU-side, however it gives me a boost in frames due to not needing to call glMapBuffer each frame.
>>
>>61533309
>
(define ((shape f) n)

What??
>>
>>61533287
>>61533324
My waifu doesn't look that old!
>>
>>61533260
Thanks, I'll do my best. We'll see how it turns out.
>>
>>61533370
The mother-in-law looks very young for her age.
>>
>>61533352
How is that a compromise? It sounds like exactly what you should be doing.
>>
>>61533230
I think you might've missed the "pretty" in that comment.
>>
>>61533398
Best girl, I want to cuddle ;_;
>>
>>61533273
Are you reading SICP? Streams are really late in SICP.
>>
>>61533352
That's not a compromise, that's just good programming. Really good stuff. I don't know how to use compute shaders yet but I definitely want to learn.
>>
>>61533416
I just got to the end of chapter 1
put the book down for months and now I'm trying to get back into it
I'm doing the chapter 1 exercises right now to try to refresh my knowledge. I was asking about exercise 1.41 last thread
>>
>>61533355
(define ((f x) y)
(string-append x " and " y))

((f "dick") "balls") -> "dick and balls"
(define g (f "good"))
(g "you?") -> "good and you?"
>>
>>61533407

I should have really written a quick and dirty debug function first to query the buffer contents GPU-side to check the values are changing first. Then I'd know it'd be good to implement, avoiding the time wasted through "trial-and-error debugging".
>>
>>61533269

Ada, C, Assembly, Scheme, Java, SQL, and Python were all required languages at some point or another. While not a part of the computer science curriculum, I also used R in a statistics class.
>>
File: 1484287289556.jpg (269KB, 1600x2400px) Image search: [Google]
1484287289556.jpg
269KB, 1600x2400px
>>61533442
This is really nice, it makes implementing message passing extremely easy.
Thanks anon, I would have never found out about it without you.
Have an anime.
>>
>>61533442
So, it's currying. Kinda ugly desu. Would rather just do
(define f (curry (x y) (string-append x " and " y)))
>>
>>61533285
Lambda calculus is entirely unrelated to "normal" calculus. The term "calculus" is a bit of a misnomer, as it can refer to any system of doing calculations. Lambda calculus is a model of computation (as in, a model for how the logic of a computer can work).

What most people call "calculus" is the fields of integral and differential calculus. They are effectively studies of change in a system (where that system is described mathematically). The first courses you do in university are linear algebra and some form of basic differential and integral calculus (in second year or late first-year you move onto vector calculus). I would definitely recommend learning them, because that's very important background knowledge if you want to be able to understand fairly basic usages of mathematics in programs.
>>
>>61531837
I fucked up, meant to make a program to practice handing out change, instead I made a exact change dispenser, any ideas how to get the script to hand a realistic amount to compared to the price, Im at a lost thinking about a hundred if/elses lol

code
https://pastebin.com/MG6KaSk0
>>
>>61533483

It seems like it's a case for a greedy algorithm.

I found a wiki page for the problem too.
https://en.wikipedia.org/wiki/Change-making_problem
>>
>>61533471
It's meant for the declaration syntax to mirror the invocation syntax, which scheme tries to achieve in function declaration syntax and also in macro syntax (syntax-rules etc.).

>>61533467
Thank you for the miku butt.
Racket has a lot of really nice gems like this that you learn over time if actually use the language
>>
>>61533518
I suppose, but my way is portable and doesn't require Dr Racket(TM). Also less of a what the fuck first time you encounter it.
>>
>>61532629
lol, good luck with that, I started to make a game, that had rouge like graphics and movements, jrpg like battle system, and a keyword interaction with npc

bulding a shit ton of static maps will take a while, I gave up because I couldnt get the battle system enjoyable though, I probably would have soldiered through taking days with the maps

I got one town, and only built 2 enterable houses, and 1 intractable npc
if your curious heres my clusterfucked code

https://github.com/codingducks/browncoats
>>
File: yukari_simpsons.jpg (22KB, 280x351px) Image search: [Google]
yukari_simpsons.jpg
22KB, 280x351px
>>61533410
Mom please get off 4chan.
>>
>>61533467
Have you ever heard of cut/cute? I find them a lot more flexible than currying usually.
(map (cut + 1 <>) (list 1 2 3 4) ; => 2 3 4 5
((cute list-ref (list 2 4 6) <>) 1) ; => 4
>>
>>61533550
That's cool anon. Yeah, I was kind of worried about that too. All the complexity adds up quick. I guess I'll make a map editor or something like that.
>>
File: well.jpg (29KB, 500x460px) Image search: [Google]
well.jpg
29KB, 500x460px
I've been getting into OOP in C++, and to try and learn it well I've been designing an "engine" that would help the development of text-based games. I just finished .01 tonight; the core logic is done and can access things like the stats menu and change your stats using the value from the Experience variable.There's still some placeholder data, but eventually I'm going to be building classes that'll make the engine have robust features like inventory management, a combat system, and several weapons classes with modifiers based on specified values. Again, I'm fairly new to programming in OOP, so if anyone has any criticisms or suggestions I'd greatly appreciate it.

https://github.com/Acescout92/AcePortal
>>
Can I add something to my CMakeLists.txt that will compile the set of files it deals with to use -Wall or other flags without applying them to the rest of the codebase?
>>
>>61533409
>I don't understand the syntax so I think it's ugly!
It's still the most beautiful fizzbuzz I've ever seen.
>>
>>61533595
>goto
>>
>>61533551
>tfw no mom to touhou with
;_;
>>
File: smug_ran5.png (325KB, 529x735px) Image search: [Google]
smug_ran5.png
325KB, 529x735px
>he's afraid of goto
Might as well amputate your arms in case you punch yourself.
>>
>>61533595

In the function login, you appear to be using the assignment operator (=) as a comparison operator (==). Don't do that.

In many of your other functions, you appear to be doing this:
label:
stuff();
goto label;


You should be doing this:
while (true) {
stuff();
}


Seriously, don't abuse goto. It just makes your code harder to read. They have a purpose, but it isn't for arbitrary loop constructs.
>>
File: 1350594293765.jpg (111KB, 500x500px) Image search: [Google]
1350594293765.jpg
111KB, 500x500px
I currently have a project containing animated and static models. Both of these have their own repositories, meshes, bounds and vertex definitions. Would it be best if I kept everything like this, with either Animated or Static prepended to the name of things, or would it be considered "better" if I separated these two into their own namespaces, so I could do something like
static::Model myModel("staticModel.obj");
animated::Model myModel("animatedModel.dae");
>>
File: 1477707979237.jpg (243KB, 1200x1720px) Image search: [Google]
1477707979237.jpg
243KB, 1200x1720px
>>61533696
I want to boob Ran.
>>
File: Untitled.png (9KB, 207x398px) Image search: [Google]
Untitled.png
9KB, 207x398px
>>61533734
*like this
>>
>>61533696
Abusing goto's is child's play. Real programmers abuse exceptions and continuations.
>>
>>61533724
Good catch, thanks. I tried to limit goto as much as possible and thought I'd largely eliminated it. I must have left it lying around in a few spots.
>>
>>61533287
I wasn't giving out advice, I was asking for it you negro.
>>
>>61533739
Leave my wife alone.
>>61533742
Who said anything about abusing? Goto can shorten the length of some algorithms and can make them very elegant if used properly. Abusing literally anything is child's play.
>>
>>61533696
To be fair, where goto isn't necessary it really shouldn't be implemented.
>>
>>61533776
The only use of goto that I'm aware of outside of assembly is in error handling.
>>
>>61533786
Proper error handling does not need goto
>>
>>61533786

Breaking out of nested loops.
>>
>>61533724
I just checked my login function, I do mean to assign the value of either 0 or 1 to x. It plays a role in the login confirm function. Please let me know if this is bad form.
>>
>>61533798
>loops
use recursion

>inb4 continuations
not goto
>>
>>61533819
>inb4 continuations
>not goto
Even more evil than goto.
>>
>>61533798
>>61533782
>>61533776

How does the scope of gotos work? Can I goto a label declared in another file? What happens if there is a goto label in some library I'm using and I just goto there? And what happens to objects? Destructors get called? What happens to the memory?
(Not trying to argue, just curious since I've never used nor needed gotos)
>>
>>61533803

I'll let you spot the problem:
int login(int x)
{
string name;
cout << "Please input username\n";
getline(cin, name);
if (name != "Acescout92")
{

return (x = 0);
}
else
{
return (x = 1);
}

}
>>
>>61533847
Depends on the language.
In C, you can only jump to a label inside of the current function, and you cannot jump into the scope of a VLA.
>>
>>61533847
You can only goto in a label in the same function.

>(Not trying to argue, just curious since I've never used nor needed gotos)
You are a giant faggot for posting that disclaimer.
>>
>>61533852
storing the password in the code
>>
>>61533859
Ecs dee
>>
>>61533852
I'm sorry, from my understanding I want x to equal either 0 or 1 depending on whether or not name is Acescout92 or not because in loginConfirm() I use that number like this:

void LoginConfirm()
{
int LogCheck = 0;
int loginOK = login(LogCheck);

if (loginOK != 1)
{
cout << "I'm sorry, you are not registered to access this program. Goodbye \n ";
return;
}
else MainMenu();
}
>>
>>61533852
>>61533903
Me again. Also, to be clear, Login isn't meant to be an actual secure login by any measure. It was just something I did to humor myself.
>>
>>61533903
What's LogCheck for?
>>
>>61533852
x is not an output variable.

void login(int& x)
{
string name;
cout << "Please input username\n";
getline(cin, name);
if (name != "Acescout92")
{
x = 0;
return;
}
else
{
x = 1;
return;
}

}
>>
>>61533920
It's the variable I'm using to store the returned value from the Login function. I think the whole system is extremely redundant myself in retrospect, but I wrote it when I was first starting out and haven't been assed to fix it up at all.
>>
>>61533927
>Sepples references
>iostreams
>Indent style
>Useless return
Absolutely digusting.
>>
>>61533927
Alternatively
int login()
{
string name;
cout << "Please input username\n";
getline(cin, name);
if (name != "Acescout92")
{
return 0;
}
else
{
return 1;
}
}

int x = login();
>>
>>61533953
That's a neat way of doing things, but what's the functional difference? The code written as is works the way I was expecting it would and prevents accessing the rest of the program if name !="Acescout92"
>>
>>61533862
Where else?
>>
>>61533961
The variable x has no reason to exist in your snippet. It doesn't do anything.
>>
>>61533943
What should I use if not iostreams?
>>
>>61533975
Really? Like I said before, it does work, but it sounds like I'm misunderstanding something.
>>
>>61533933
You aren't storing anything in it, when you call login the x it's a just a copy of LogCheck on a different memory cell, so modifying it has no effect on LogCheck
>>
>>61533970
>storing the password at all
>>
>>61533970
You should store a hash of the password on a resource file, like a database or something
>>
>>61533996
Ahhh. I understand. But that being said, why does this actually work, then? If I provide any input that isn't the desired string, it kills the program. Otherwise, I'm able to get to the main menu.
>>
>>61534021
Because you are returning x into loginOK
>>
>>61534042
That was the idea, but
>>61533975
is stating that x isn't doing anything.
>>
>>61531921
guess ill roll
>>
>>61533847
You can do what you're wanting in C with something called longjmp, but it requires you set up the jump beforehand. And in scheme with a continuation. Also requires you set up the continuation beforehand.

$(define jmp '())
$(+ (call/cc (lambda (cont) (set! jmp cont) 1)) 1)
=> 2
$(jmp 2)
=> 3

As for what happens to the memory, it's left hanging there.
>>
File: dBqo9Gt.png (130KB, 396x381px) Image search: [Google]
dBqo9Gt.png
130KB, 396x381px
>>61534058
>>
>>61531921
rollerino
>>
File: 148508538838.png (26KB, 861x758px) Image search: [Google]
148508538838.png
26KB, 861x758px
I've been """"programming"""" off and on for five years, but my current project is the only one I can call consistent and nearing completion. I've worked on it for 3 months, it has 5000 lines of code, and I've really learned to appreciate all the hard work that goes into making a program function and execute as intended.

Half the time I spent was on fixing bugs, improving efficiency, and generally making the experience much more accessible for the user. I feel productive, I feel like I'm doing something, and I don't want this feeling to go away.

Feels good man.
>>
61534075
Dumb frogposter

61534109
Dumb frogposter

Go back to >>>/r/ibbit
>>
>>61534058
He's right, you are actually assigning a value into x and then returning it, but you could skip the assignment and just return 0 or 1, no need to store it in a temporary variable
>>
>>61533847
In C, longjmp is like this:
#include <setjmp.h>
#include <stdio.h>

void main() {
jmp_buf cont;
int i = setjmp(cont);
printf("%d\n",i);
if(!i)
longjmp(cont,2);
}
//0
//2

longjmp makes the CPU jump back to where setjmp was called, replacing setjmp with the second parameter. When you call setjmp, it returns 0.

jmp_buf in the C program and jmp in the Scheme program are continuations.
>>
>>61534122
holy shit I'm an idiot, that's made it all clear. Thanks, man!
>>
>>61534109
What is it?
>>
>>61534149
Opencv app where you can swap backgrounds from your photos. Uses image segmentation via grabcut method.
>>
File: 1478719965366.jpg (2MB, 2480x3508px) Image search: [Google]
1478719965366.jpg
2MB, 2480x3508px
>>61534118
*>>>/k/ero

>>61533927
dumb baka cirno, I will eat you
bool
login (void)
{
string name;
cout << "Input username, onegai" << endl;
getline(cin, name);
return name == "Acescout92";
}
>>
File: 1500792242088.jpg (163KB, 1440x1490px) Image search: [Google]
1500792242088.jpg
163KB, 1440x1490px
if(post_number > 4)
masturebateToAnimeTiddies();
else
doDailyProgrammingThings();


Why has nobody made a *chan where you can roll for something and get results using your post number?
>>
>>61534196
>(void)
>>
>>61534196
>void
>>
>>61534196
>bool \n
>(void)
What's the matter, you dumb anime slut? Were you not getting fucked by enough dicks while writing that post? Shameful whore. Sudoku yourself.
>>
>>61534196
>(void)
>onegai
what did you DO
>>
>>61534247
>>61534259
>>61534269
>>61534295
>Not using (void)
What kind of stupid fucks are you?
>>
>>61534305
I'll fuck you stupid, you slut!
>>
File: 1494572883282.png (443KB, 650x433px) Image search: [Google]
1494572883282.png
443KB, 650x433px
>>61534247
>>61534259
Yes anons

>>61534269
I use the only proper style, the GNU style.

>>61534295
baka cirno
>>
>>61533852
>>61533903
>>61533927
>>61533953
>>61534196
You're all fucking terrible.
#include <stdio.h>
#include <string.h>

_Bool login(void)
{
char input[256];
fgets(input, sizeof input, stdin);

char *nl = strchr(input, '\n');
if (nl)
*nl = '\0';

return strcmp(input, "xXxAcescout420Bl4z3xXx") == 0;
}
>>
>>61534342
Is Ran a good programmer?
>>
File: ran's_DMRG.png (1MB, 900x1440px) Image search: [Google]
ran's_DMRG.png
1MB, 900x1440px
>>61534364
Ran's much better than that frogcunt.
>>
>>61534363
Delet this
>>
>>61534363

>You're all fucking terrible.
All I did was post the original, flawed code.
>>
>>61534382
this will never be a funny meme
give up h
>>
>>61534390
Yes, but you're terrible for different reasons.
>>
File: trashkell_on_suicide_watch.png (448KB, 580x1500px) Image search: [Google]
trashkell_on_suicide_watch.png
448KB, 580x1500px
>>61534396
Where's the meme? That Ran's a better programmer than you?
>>
>>61534403

Acceptable.
>>
File: 1482764083887.jpg (1MB, 1219x1722px) Image search: [Google]
1482764083887.jpg
1MB, 1219x1722px
>>61534363
Total baka

#include <stdio.h>
#include <string.h>

_Bool login(void)
{
const char pass[] = "cirno baka baka!";
char input[sizeof pass];
fgets (input, sizeof input, stdin);

return !memcmp(input, pass, sizeof pass);
}


>>61534382
no u, kero kero
>>
File: 1469491065425.jpg (57KB, 1024x569px) Image search: [Google]
1469491065425.jpg
57KB, 1024x569px
login = ("Acescout92" ==) <$> getLine


please don't bully
>>
File: Modular.jpg (1MB, 4048x3036px) Image search: [Google]
Modular.jpg
1MB, 4048x3036px
>>61531837
If my PCBs ever fucking show up, I have a few more modules I'd like to make
>>
>>61534426
>const char pass[]
Make it static.
Yours erroneously succeeds if the password is a prefix of the provided string.
>>
>>61534452
One is Teensy-based and the others are run on a STM32F405RGT6
>>
>>61534468
It also erroneously succeeds if fgets returns an error and input somehow happens to have the content of pass (because its value is undefined)
>>
>>61534452
This looks great anon, what modules do you have in this?
I am fascinated by modular systems myself but I never made more that a few stompboxes.
(I'm more versed into digital stuff, the DAFX, Puredata and C.)
>>
>>61531837
Learning how to make a web scraper in Python
>>
https://mail.haskell.org/pipermail/ghc-devs/2017-July/014422.html

GHC 8.2 out
>>
File: 2017-07-24_02-33-17.png (39KB, 2162x1634px) Image search: [Google]
2017-07-24_02-33-17.png
39KB, 2162x1634px
>>61534588
From left to right:
Noise Reap LFO
Noise Reap Loafers (quad LFO)
Blue Lantern Simple VCLFO
Noise Reap Passive Multiple
Zlob Modular Triple Attenumixer
RYO Penta Sequencer + Expander
Music Thing Modular Turing Machine MkII
Expert Sleepers Distink MkIII
Music Thing Modular Radio Music
Noise Reap Bermuda
Synthrotek ADSR
Synthrotek Stereo Output Mixer

All of them are DIY except the Blue Lantern LFO, Disting, and NR Multiple.

If you want to get in to modular, I definitely suggest this case to start (Make Noise powered skiff). $250 seems like a lot for something that doesn't do anything other than house and power your modules, but it's seriously cheap in comparison to other offerings.
The past couple of days I've been mocking up panels for a custom case once I hit college next month because I can use a laser cutter for free on campus.
>>
>>61534588
I have PCBs for a Mutable Instruments Ripples, Veils, and an mxmxmx Ornament & Crime in the mail right now which will fill this skiff, but if they don't show by the end of the week I'm probably going to end up buying PCBs for a MI Clouds and Braids from a more local source.

Modular is a dangerous game, especially DIY. You might just end up like me, throwing shit loads of money at it for a hobby.
>>
What would you use statistics for in programming? Because I can't really see it's use.
>>
>>61534904
Machine learning is really all just statistics. Large companies like Google and Amazon made it this big because they applied statistical algorithms to large amounts of data.
>>
>>61534936
So basically, it's not useful for me.
>>
>>61534363
>strcmp
Shit 0/10 code, Never touch a computer again.
>>
>>61534363
>>61534426
You both suck.

#include <iostream>
#include <string>

bool login() {
std::string input;
std::getline(std::cin, input);

return input == "HomuraDidNothingWrong";
}
>>
>>61535117
lmao
>>
>>61535135
What's so funny
>>
>>61531876
why do you have such bad taste in programming languages

professional game developers use C++ for a reason
>>
>>61535206
professional game developers use C++ because they have to
>>
>>61535284
yeah they would love to use idris if only their slave drivers would let them
>>
>>61534904
I use it quite a bit. Some use cases are:

> writing a bot which learns to buy / sell at the right price
> identifying gestures with computer vision
> breaking captchas
> identifying whether a picture is lewd or not
> helping a robot navigate autonomously
> classifying spam
> recommending products / articles
> predicting the next action of some thing (e.g. where will the car drive to)
> detecting intrusion / fraud

In summary, it's useful if you work with probabilistic (uncertain) data
>>
>>61535117
>>61535164
>C++
AHAHAHAHAHAHAHAHAHAHHAHAHAHAH
>>
File: Untitled.png (4KB, 317x125px) Image search: [Google]
Untitled.png
4KB, 317x125px
I am using C++. Will these arrays be 0-filled when I allocate a VertexBoneData struct on the stack,or will they contain random data?
>>
>>61535568
They will contain random data.
Use
= {0}; 
to zero-initialize them if you want.
>>
>>61535589
Like this?

#define MAX_BONES_PER_VERTEX 10

struct VertexBoneData
{
unsigned int ID[MAX_BONES_PER_VERTEX] = {0};
float Weight[MAX_BONES_PER_VERTEX] = {0};
};
>>
>>61535613
Yes.
Once you initialize the first (with 0), you also initialize the rest. You didn't say what value to initialize the rest with, so it defaults to 0 and 0.0f.
>>
>>61535629
Thanks!
>>
Now I have to make a matrix multiplication program in assembly. Fun...
>>
>>61536117
For something like that couldn't you just write it in C. Compile and disasm then modify it?
>>
>>61536117
It's actually fun because you can use some crazy AVX-512 stuff.
>>
>>61536132
I might actually try that. I would have to figure it out in C first anyway.
>>61536171
Sounds like something for people who are good at this stuff.
>>
I'm tired of qBittorrent. I think I'm going to implement a torrent client myself using the only good system language, Pascal. brb downloading Lazarus.
>>
>>61536208
SIMD isn't that hard really. I don't see why anon thinks it's fun though.
>>
https://github.com/hatcat/include
>#include
>A diversity group for C++ developers.

> Software development is a problem-solving discipline, the pursuit of which is not suited towards any particular gender or ethnicity, demanding only intellectual acuity, rigour and stamina.
> Lack of gender and ethnic diversity diminishes the discipline by reducing the pool of talent available to solve pressing software development problems.
> Lack of awareness of gender and ethnic diversity diminishes the discipline by considering only a small portion of potential users in the solution domain.
> The appeal of software development, and the horizons of existing developers, must be broadened, such that ALL may be included in the talent pool and ALL may be included in the user domain.

So, why are you against diversity, /dpt/? It looks reasonable.
>>
File: big cat (4u).jpg (426KB, 1024x683px) Image search: [Google]
big cat (4u).jpg
426KB, 1024x683px
Reimplementing my x86-32 obfuscator to support both x86-32 and x86-64

That was more work than expected
>>
>>61534363
You posted this to show how not to read from input, right?

90s levels of insecure
>>
>>61536520
Explain how it is insecure in any way.
>>
>>61535568
>not using const int
>>
>>61536328
reasonable how? what can i use this "code" for?
>>
>>61536532
With only 3 functions to research, I feel like you should find out by yourself

/g/'s attempt at C always end with hilarious fiascos
>>
>>61536328
We just don't give a fuck. Can the person do it or not? That's the sole question.
>>
>>61536558
I was the one who wrote that.
Please tell me why YOU think it's insecure.
>>
File: 1500885912072.jpg (87KB, 485x340px) Image search: [Google]
1500885912072.jpg
87KB, 485x340px
>>61534363
shig
>>
if your code produces warnings with -Wpedantic you''re a shit coder
>>
>>61536564
I know why it is insecure. You figure it out.
>>
>>61536675
i.e. you have no fucking idea what you're talking about.
>>
>>61536675
>I make a claim
>fix your problem
Anon stop spelling things wrong.
>>
File: 1484497285541.png (204KB, 744x843px) Image search: [Google]
1484497285541.png
204KB, 744x843px
>>61536666
Begone, Satan!
>>
>>61536680
So what do YOU think would happen if I were to cause an EOF (^C) while having typed partial input?

fgets fails (which you do not check), and strchr is no longer working on a terminated string.

Oops.


Hang yourself.
>>
>>61536680
>>61536695
>program in C
>don't actually know C
>>
>>61536708
>cause an EOF while having typed partial input
fgets would terminate the string correctly and no newline character is written.
>and strchr is no longer working on a terminated string
strchr will work fine if there is no newline character there.

Actually, there is one situation the code doesn't handle correctly and that is EOF with no input at all, in which case fgets doesn't do anything.
The array need to be changed so it's initialised which easily fixes that.
>>
>>61536761
>fgets would terminate the string correctly and no newline character is written.
Only if fgets succeeded is the buffer terminated. Whether it succeeds from ^C depends on how gracefully the interrupt is handled, but a user could purposefully cause an error to guarantee it fails.

Literally babby's first C 101.


>Actually, there is one situation the code doesn't handle correctly and that is EOF with no input at all, in which case fgets doesn't do anything.
>The array need to be changed so it's initialised which easily fixes that.
Nope, this is not a problem.
>>
>>61536839
>^C
Ctrl-C is kill the program, idiot. In which case, it doesn't fucking matter what fgets does, the program is not going to continue.
>>
>>61536891
>Ctrl-C is kill the program, idiot
No, it's SIGINT.
>>
#include <memory>
#include <iostream>
#include <type_traits>

struct IBarkable
{
virtual void bark() = 0;
};

int main()
{
struct: IBarkable
{
void bark() override { std::cout << "Bork" << std::endl; };
} stack_dog;
stack_dog.bark();

struct: IBarkable
{
void bark() override { std::cout << "Woof" << std::endl; };
} *raw_heap_dog = new std::remove_pointer<decltype(raw_heap_dog)>::type;
raw_heap_dog->bark();
}

is it possible to make a unique_ptr without naming the implementation type?
>>
>>61536911
https://ideone.com/6DY5LB
>>
>>61536911
>raw_heap_dog = new std::remove_pointer<decltype(raw_heap_dog)>::type

Is this even valid?
>>
>>61536925
compiles for me
>>
>>61536939
Looks like I'm mistaken.
>>
>>61536911
Not according to the standard:
>The following types shall not be used as a template-argument for a template type-parameter:
>an unnamed class or enumeration type that has no name for linkage purposes (7.1.3 [dcl.typedef])
>>
>>61537017
>that has no name for linkage purposes
what does this bit mean?
>>
>>61537056
Probably that the linker must find a name for the type that's used to substitute the template parameter, you can however do the following to take ownership of a raw pointer:
#include <memory>
#include <iostream>
#include <type_traits>

struct IBarkable
{
virtual void bark() = 0;
};

int main()
{
struct: IBarkable
{
void bark() override { std::cout << "Bork" << std::endl; };
} stack_dog;
stack_dog.bark();

struct: IBarkable
{
void bark() override { std::cout << "Woof" << std::endl; };
} *raw_heap_dog = new std::remove_pointer<decltype(raw_heap_dog)>::type;

std::unique_ptr<std::remove_pointer<decltype(raw_heap_dog)>::type> uniq{raw_heap_dog};
uniq->bark();
}
>>
>>61531921
bored
roll
>>
Which of the following two methods is faster?

if(condition)
return thing;
else
return otherThing;

or
if(condition)
return thing;

return otherThing;
>>
>>61537155
Doesn't matter, though I think that later is often used.
>>
>>61537155
Depends on the language but they're generally equivalent because they compile to equivalent basic blocks.

In an interpreted language though all bets are off
>>
>>61537155
GCC compiles both to the same thing.
>>
>>61537155
doesn't make a difference after it gets compiled

I like to do this
if (condition)
return thing
else
return otherThing;

function()
{
if (fail)
return badThing;

do();
lots();
of();
work();
return goodThing;
}
>>
>>61537165
>>61537169
>>61537180
>>61537184
In GLSL (the OpenGL shading language) specifically
>>
File: negerpadda.png (114KB, 420x420px) Image search: [Google]
negerpadda.png
114KB, 420x420px
>>61536891
>Ctrl-C is kill the program
I think this is enough /g/ for one day...
>>
>>61537191
>negerpadda
Found the swecuck
>>
File: bbt.jpg (70KB, 370x370px) Image search: [Google]
bbt.jpg
70KB, 370x370px
>>61537194
>the know-neither-C-nor-basic-OS-principles cuck
>>
>>61537155
>>61537184
>multiple return paths
disgusting
>>
>>61537225
guard clauses are much more readable than nested conditionals
>>
>>61537225
Wakeup gradpa, you've shit yourself.
>>
>>61537237
Agreed
>>
>>61537219
I am >>61536899 you dolt, I just wanted to point out that you're not anonymous when you make mistakes like this.
>>
>>61537225
>Actually thinking there's anything wrong with that when the return statements are perfectly identifiable in the code and it makes reading the code easier
Kill yourself.
>>
Do microkernels still suck?
>>
Traits are the amazing mechanism allowing more generalization. C++ is going to have Concepts at some point, but right now there aren’t any and there is a number of drawbacks connected with that. For example, many C++ Standard Library functions accepting parameters of some special type aren’t able to check whether passed parameters are having the correct metatype efficiently, e.g. special iterator metatype (ContiguousIterator, RandomAccessIterator, etc). std::sort functions look like this:

template< class ExecutionPolicy, class RandomIt >
void sort( ExecutionPolicy&& policy, RandomIt first, RandomIt last );
template< class RandomIt, class Compare >
void sort( RandomIt first, RandomIt last, Compare comp );
template< class ExecutionPolicy, class RandomIt, class Compare >
void sort( ExecutionPolicy&& policy, RandomIt first, RandomIt last, Compare comp );
>>
>>61537377
Yes.
t. an occasional contributor to https://www.redox-os.org/
>>
>>61537389
What are tratis?
>>
>>61537389
what a meme language
>>
>>61537415
Not him, https://doc.rust-lang.org/1.8.0/book/traits.html
>>
>>61537377
Sort of, but not entirely.
>>
>>61537431
What makes this different to e.g. an Interface in Java?
>>
>>61537409
Isn't that just because it's Unix-like?
>>
>>61537442
https://softwareengineering.stackexchange.com/questions/247298/how-are-rust-traits-different-from-go-interfaces
>>
>>61537431
>>61537389

>port type classes (Haskell™) over to your language
>call them something else

Why do they do this?
>>
>>61536532
>strcmp

Enjoy your non-constant time comparisons
>>
>>61537409
Do you think the entire concept is hopeless?
I've been hoping that things like IOMMU support could speed up device drivers running in userspace
Monolithic kernels are a huge attack surface so I really wish there was an OS that ran everything possible in userspace (with mandatory access control support)
>>
>>61537479
They just did
>>
>>61537496
Why though?
Why can't they just call them type classes?
>>
>>61537501
It's not Haskell
>>
not really working on it yet, but I call it CityLog
its basically a map where you could put locations on it as you find them while travelling.

you can subscribe to other peoples maps for example if you were to visit another city on holiday, you could sub a local persons map of that city so you have a map of interesting places in the city youre travelling to
>>
>>61537489
null-terminated strings were a mistake
>>
>>61537505
Why don't they call type classes type classes?
Why do they come up with a new name?
>>
>>61537518
You are needlessly dragging a conversation that has not effect in the world
>>
>>61536532
strcmp side channel
>>
>>61537530
Why are you so defensive about this?
>>
>>61537518
Because Rust is a snowflake language. Everything it does is revolutionary.
>>
>>61537566
Why should all language be the same? Are you a communist?
>>
>>61537297
Mistakes like what?

I don't rename my images because I'm not some little obsessive neckbeard.

Are the collective of anime-watching tech-illiterate pedophiles of /g/ going to hack my computers?
>>
>>61537442
You can implement traits to any existing type.
>>61537479
Because "class" is an overused term.
>>61537463
Maybe, to some degree, but I'm uncomfortable with the amount of copying and context switching going on, and it's inherent to micro-kernels. I mean, we have a daemon what implements a file system and a daemon what implements a low-level hard drive management, so each write to a disk requires at least several context switches with data being copied back and forth.
>>61537495
I don't know, I'm not an authority in any sense, I'm just a low-level guy who spent some time on the project and I don't think this approach will ever be anywhere near monolithic kernels performance-wise. I have no idea what people at seL4, Minix3 or Gnu HURD are doing tho, maybe they have it figured out.

It's fun to work with tho, all the modules are highly isolated and you can add new kernel-level functionality (like new network protocols, drivers or filesystems) just by writing user-level daemons.
>>
>>61537566
But it's not just Rust.
C++ is calling them concepts.

>>61537575
Now I'm certain that you have malicious intent
>>
>>61537580
C++ already has enough class shit to worry about, id actually argue thats a good name change. Whereas Rust had no logical reason to change them besides maybe thinking traits sound cooler and type classes sound boring/C++-like
>>
>>61537596
What's wrong with cool terms?
>>
>>61537624
Not edgy enough
>>
>>61537501
I don't know why we need 5 different names for the same underlying concept either
>>
>>61537624
Nothing besides giving off the implicit idea that theyre a creation of the language and not an already done concept. Thought I believe its actually just to keep things simpler because Rust's cult-obsession with beginners and making sure their rubber padded ride through Rust-land is 100% disney magical.
>>
>>61537631
Yes, everything is a sequence of bits, calling them by the bits is the most universal solution to this oh-so-big problem
>>
>>61537656
You're that guy from before.
You seriously sound like you have malicious intent.
What's your end game?
>>
>>61537664
Crashing this plane
>>
>>61537676
Do you work on one of those languages?
Do you stand to gain from one of those languages?
>>
>>61537687
Do you?
>>
>>61537698
Answer the question you cunt
>>
>>61537707
Exactly
>>
>>61537676
>>61537698
>>61537709
You're a real fucking smart guy with some clever fucking jokes, clearly you've been here a while and haven't just got here from reddit
>>
File: 1496020714139.jpg (1MB, 960x1280px) Image search: [Google]
1496020714139.jpg
1MB, 960x1280px
>>61537719
What else do you think of me?
>>
Its time you weenies
>>61537779
>>61537779
>>61537779
>>
>>61531837
>android app
>get user to sign in with google
Is there any way to access his google searches after this?
>>
>>61533180
with a debugger
>>
>>61537191
>negerpadda.png
kek
>>
>>61535449
What? Is the code too good for you so you have to defend yourself and your shit language by laughing at it?

That C++ code is 100000x better than the trash you shat out.
>>
>>61537377
Yes.
Microkernels suck by concept and design.
>>
>>61537409
Why do you contribute to such a garbage OS?
Even Haiku is magnitudes better than Redox.
>>
>>61537780
That your a trapfag who should kill him/her/itself
Thread posts: 320
Thread images: 35


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