/dpt/ - Daily Programming Thread

Old thread: What are you working on, Jow Forums?

Attached: 1563950584169.jpg (850x1200, 176K)

Other urls found in this thread:

en.cppreference.com/w/cpp/language/variable_template
youtube.com/watch?v=mUQZ1qmKlLY
youtube.com/watch?v=_bYFu9mBnr4
twitter.com/NSFWRedditGif

Do NOT learn haskell

Attached: 1567267248028.jpg (1280x720, 234K)

>what are you working on
finalizing suicide plan, it's finally time
can't believe I still haven't finished a single project but what can you do

40% of Rust programmers know this feel

Attached: EDU6tjLUUAIYvqp.png (750x617, 399K)

What's a good jack of all trades babby language?

Haskell is fun!

brehs, is it really necessary to go through HTDP before PAPL?

thanks

Attached: 1562117321340.jpg (1080x1080, 173K)

python, but don't learn python it will melt your brain into rancid goo.

Who is this girl (boy)?

Ok then, what scripting language won't make my brian to a rancid goo?

No idea, but you can use yandex reverse search, it's pretty good.

Also pls help

I want to sodomize Hifumi

never post my wife again

Attached: 1510544517811.jpg (555x547, 54K)

What do you look for in code reviews?
I started my first Dev job last month and I'm not sure what I'm reading half the time or why it might be bad other than like "can we make this private or rename this".

unrelated weebshit fuck off

This. Go to weeb dev general.

>pls help
I'm afraid nobody will help. People just tell you to read the books for meme reasons without having actually read them.

Stop or I will pat your head to death.

Calm down. How lonely do you feel? Want to talk?

C++ tutorials go from easy to hard to fucking incomprehensive. What's a good way for a novice to learn online?

Write programs yourself with the knowledge you acquired before moving on to harder concepts.

C, but with universal and existential quantification.

you can encode existentials with universals (probably vice versa too)

I do, but when I read other people with experience's code it just goes completely over my head. How am I supposed to bridge the gap?

Working on my first mobile app using vuejs. It's also my first time using typescript for anything serious and it's quite comfy.

I'm slowly going through learncpp.com during my free time, can't talk about the second half yet but it's quite decent so far.

doing pythonchallenge. i had to parse a bunch to text files in zip archive and get the comments associated with each one. but it just looks like gibberish it's supposed to a form a message.

E Y *E Y ON ***** *Y *E
*OG
* Y G E* Y E* N* G**G* ** * * * * O X**E

of ascii art. that is how the last answer was. just not sure how to decipher the gibberish.

only by adding one level of function application which is not something you want in C

you don't want polymorphism with pointers either

How should I go about building up my resume and portfolio? Right now I just started faffing about with relatively simple Lua scripts, and I'm about to get into some C# vidya modding shit too, both mostly just to learn the languages. Will sufficiently advanced game mods be good for a portfolio, or should I do something else?

better than void* everywhere

-- suppose
malloc : Storable a => Ptr a
-- _:=: :: Storable a => Ptr a -> a -> ()

x = malloc
-- x : Storable a => Ptr a
x := 3
x := True

what are you trying to express here, that it makes the type system unsound? because void* already does that

Let me see that JavaScript project, Anone.

Attached: 66e4a4cc1900d6403c3caa273611b4a3.jpg (1080x1080, 118K)

function(){}()

When a webshitter says they launched a "webapp" does that just mean they wrote a page that uses a lot of javascript?

Attached: toji-no-miko.png (1920x1080, 2.11M)

Lisp is the most powerful programming language.

yes

i want to nakadashi hifumi-senpai

...

Cute 123

Is Nim a meme?

I want to pair program with Hifumi.

Attached: average japanese gamedevs.png (1102x1560, 1.53M)

What does this do? I can't understand it.

Creates a pointer called x
Assigns an int to x
Assigns a bool to x
It's to point out a bug with certain type systems and references. The problem is the pointer stays generic, so you can instantiate it and then assign to it, when you should only be allowed to use it with one type.

What's wrong with python? Is it super difficult?

Isn't she just a designfag? I doubt she can program.

wish i had a 3d artist gf to make video games with

There's pretty much no way I can respond to your post without sounding like a retard, so I'll just say thank you for attempting to explain it to me.

Do you know what a reference or a pointer is? in C this is like
void* x = malloc(1);
*x = 3;
*x = true;

But void* doesn't pretend to be type safe.

You can't assign to the void type, you dumbass.

that's wrong though

well i didn't test it, i said it was "like" that. you probably have to explicitly cast x in that case. in C++ it's like this
void *px = malloc(1);
template
T* x = px;
*x = 3;
*x = true;

inb4 this doesn't work

ofc you probably need to explicitly cast void* for it to work with C++, x = (T*) px;

I don't know what a point, an int, a bool, type systems or references mean. I don't know what a pointer staying generic means. I don't know what instantiating a generic pointer means, what you can assign to it and why it's a problem. I don't know why you should only be allowed to use one "type".

Basically I don't know anything and we're on different pages, if not different books.

>I don't know what a pointer, an int, a bool, type systems or references mean
Do you know where you are right now user?

Attached: 1566990742759.png (726x1040, 642K)

That would be:
void *px = malloc(1);
int *x = static_cast(px);
*x = 3;
*x = true;
But that only works because there's implicit conversion rule from bool to an integer.

What's a good video tutorial that builds something with C++. I'm reading through a book right now and I understand the concepts, but I need something that shows me how to write up to date C++ code, so I don't have to figure that out myself.

No, I mean to leave x templated. C++ has variable templates now if you didn't know btw (otherwise make it a function and return px, then call where it's used).

The idea is that you have a templated pointer that points to the same address, so you can do
*x = 3;
*x = true;
That's the problem with regular generics and pointers or references.

How would that work with runtime code though?

I'm sorry. I wrote my first bash script yesterday and I thought I could come here and see what other people were talking about with regards to programing. You guys are way above me.

I made a minesweeper game in Javascript with some basic HTML/CSS, it's kawaii~

Attached: Screenshot from 2019-09-03 15-26-48.png (1449x807, 31K)

don't worry user, /dpt/ is for all levels
keep up the good work

Actually nevermind, I suppose you could do:
#include

struct Storable
{
Storable()
{
p = malloc(1);
}

template
Storable &operator =(T &&value)
{
*static_cast(p) = value;
return *this;
}

private:
void *p = nullptr;
};

int main(int, char **)
{
Storable s = {};
s = 5;
s = true;

return 0;
}

Thank you.

en.cppreference.com/w/cpp/language/variable_template
it has to be namespace level. i assume it creates the variable when you instantiate it. an example is the upcoming math constan ts stuff
template
T pi = 3.14...;

I realize, that's why I asked about runtime, since templates are evaluated at compile time, but I suppose you could have a wrapper that just does it with a static cast under the hood (like I did ) but that's largely irrelevant to all of this, I was just kinda answering my own question.

>You guys are way above me.
Alot of Jow Forums are just consumerist fags who don't know anything about computers. If you're writing basic bash scripts then you're already ahead, especially if it's on GNU/Linux.

Trips of truth

the seven's can't be wrong

assumes sizeof T == 1

I'm sure there's an actual use to a recastable thing like this, but in this case it's about a problem with type systems.
Suppose you had
template
T* malloc_(size_t bytes);
What type would you infer for x?
auto x = malloc_(1);
Well in actual C++ this would probably fail with an error, but in some systems you would say "give x the most general type". Which would be the same as the return value for malloc_ - and you would *keep it generic*. This is where the problem comes in, because now you have
template
T* x = some specific memory location;

where the memory location is the same for any choice of T, which absolutely isn't intended

Storable itself is just a haskell concept for types that you can do C-esque memory stuff with.

>The member functions of this class facilitate writing values of primitive types to raw memory (which may have been allocated with the above mentioned routines) and reading values from blocks of raw memory. The class, furthermore, includes support for computing the storage requirements and alignment restrictions of storable types.

This, pls halp

BUMP I NEED TO KNOW

Yes but also no

btw
int = integer
bool = boolean
a value is boolean if it's either true or false (sometimes represented as 1 or 0, or as T or F)
usually int implies it's limited too, e.g. on my machine haskell's int only represents about -10^19 to 10^19 (or 2^63)

Thanks, I'll learn it.

all I wanted was to be able to write this
void foo(void (*f)(T*), T *args);
struct methods
{
void (*method1)(T*);
void (*method2)(T*);
};
struct interface
{
struct methods *methods;
T *data;
};

// this introduces an existential type variable IDK what syntax to use
struct interface interface;
interface.methods->method1(interface.data);

I'm going to start with this:
youtube.com/watch?v=mUQZ1qmKlLY

That's pretty interesting. I never new what boolean meant before.

>published 2017
>that google page
christ how old is this shit actually

Is there any advantage in C++ on using bool instead of uint8_t? Does the compiler do further optimizations?

Boolean implies two possible values, not 256.

It can, since values that aren't 1 and 0 are trap representations.

the main use is that you only want there to be true and false and you might get warning messages where other things might arise
for things like std::vector there used to be an optimisation that stored std::vector as a bitvector but seething autists complained their
needless C manual memory tricks didn't work with it

when codeblocks was version 10

>optimisation that stored std::vector as a bitvector
Isn't that more often than not a misoptimisation rather than an optimisation or was the compiler smart enough to figure out when it was appropriate to apply it?

It was an optimization, but it was also a shitty idea. It should simply have been a different type.

>was the compiler smart enough to figure out when it was appropriate to apply it?
The template isspecialized, so anytime you used std::vector it would switch to that specific implementation.

>misoptimisation rather than an optimisation
Depends. In terms of performance yes as no CPUs I'm aware of are able to do arithmetic with bits, but in terms of memory not.
This can be useful when dealing with system with very limited memory such as microcontrollers or very old systems.
However bitfield structs are much more handy in such cases.

From what I've read, a bit vector is usually slower than a typical vector of bools for most use cases. Either I've been misinformed or it's a good thing that this was changed.

we should get a std::packed_vector

>no CPUs I'm aware of are able to do arithmetic with bits
good post retard

Could you do something like:
#pragma pack(push, 1)

template packed_vector: std::vector {};

#pragma pack(pop)
Or does it not work like that?

>have to use WPF at work
>honestly not so bad
>boss "Hurr durr Codebehind sucks, we gon use MVVM now"
>everything that used to be a trivial is not a pain in the ass
After writing the 50th memeconverter and relative multibinding bullshit I just want to kill myself

How about this?
youtube.com/watch?v=_bYFu9mBnr4

vector is perfectly fine 99.9% of the time

>got offered a job at a Fortune 50 company
>they'd be paying me 20% more than my current one
>would have to code in javascript
...should I?

Attached: 1567454456673.gif (720x312, 1.74M)

>Rust was the "most loved programming language" in the Stack Overflow Developer Survey for 2016, 2017, 2018, and 2019

Whats the reason for this

Attached: reallythink.png (512x512, 112K)

> lol Python

can you just legally pass functions and lambdas as function and method arguments and sometimes have them be called with ()
or something bad is going to happen?

depends, if you want the money, then I think it's worth playing with shit, if not then probably no