/dpt/ - Daily Programming Thread

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

Attached: dpt2.jpg (300x300, 36K)

Other urls found in this thread:

github.com/samrushing/irken-compiler)
github.com/juancarlospaco/nim-presentation-slides/tree/master/ejemplos/avanzado/multithread
nim-lang.org/docs/threads.html
twitter.com/NSFWRedditGif

>have been banging my head on a design problem for days
>just learned that it's called the "Fragile base class" problem
Virtual functions were a mistake

nth for typed racket except not incredibly painful and tedious to write

thanks for using an anime image

Working with Unix Domain Sockets in Rust :)

no problem bro

maybe you can tell me: is there a reason why they can't make it easier?

is there an equivalent to haskell's type keyword in c++?
neither using nor typedef define a new type (which i want to use with a friend declaration)

template
using Vec = std::vector;

Lisp is the most powerful programming language.

Anone! Your JavaScript project is soooo cool!

Attached: 3025719220df639a04e8f001f27adf05--elegant.jpg (1200x1600, 326K)

[] is completely unnecessary, and probably just there because they were too lazy to refactor parsing/tokens.
: and -> is just trying to mimic ML for some reason, but they have to keep to Lisp polish notation, so it's pretty awkward.
My experience with racket/lisp just convinces me ML syntax and way of doing things is superior.
And i'm pretty curious why Dr Racket's theme selector is so GC-heavy and is pretty unusable no matter what CPU you're using.
Dr Racket is still pretty cool though, I think a first-class IDE is not really explored as much as it could be.
Idris sort of explores the idea further with the extension.
And Clean has one, but it's windows only.

reposting

Attached: HELP.png (372x284, 105K)

When are you going to program your waifu AI?

That's not what he's talking about.
Unfortunately there's no keyword. If you just need a new integral type an empty enum class works pretty well. I'm not sure what you mean by wanting to use it in conjunction with friend though.

using is the equivalent of haskell's type keyword though

I think he meant newtype? A strong typedef.

I am trying to build a web client for IRC that does not suck. Using React and Socket.io

Features:
- Friend list, ALWAYS fucking visible.
- Logging together different nicks, to avoid shit like having different logs for MyFriend, MyFriend_, etc...
- Add notes to nicks, to remember some shit they told you in the past, without having to browse their logs
- Set custom nicknames for users

If you have any other ideas, please share them.

Attached: 1565796615388.png (2537x1365, 78K)

oh, i guess just a struct
#define newtype(x, t) struct x { t data; }
newtype(nat, int);
nat x = { .data = 3 };

yeah, well, i think i was referring to newtype
i haven't programmed in haskell for a while

template
class ConfigPrimitiveValue;

using ConfigBool = ConfigPrimitiveValue;
using ConfigInt = ConfigPrimitiveValue;
using ConfigFloat = ConfigPrimitiveValue;

template
class ConfigPrimitiveValue : public ConfigValue
{
friend ConfigBool;
friend ConfigInt;
friend ConfigFloat;

private:
const T m_value;

protected:
ConfigPrimitiveValue(T value)
: m_value{value}, ConfigValue{ValueType} {}

public:
auto get_value() const
{
return m_value;
}
};


this is what i wanted to do

I wonder if Irken does it any better. (github.com/samrushing/irken-compiler)

your post is going to need more reddit spacing if you want people to read it

looks to be an improvement.
I just think Lisp isn't for me and my autism though.

What's the point of friend there? Those are just aliases of the type you're defining, friending isn't going to do anything there.

yes, that's my issue

any resource recommendations to get started with C++ and QT5?

Learn Lisp.

EVEN more?

it already had one and i was already exhausted. how do the javachads do it

Attached: 7567684.jpg (405x405, 20K)

type system nerds btfo

Attached: lanky_nerd.png (580x266, 50K)

In C and a lot of other languages, zero and false are equivalent. Non-zero and true are also equivalent. So you can say "if this is nothing" or "if this is something" .
int error = some_calculation();
if (error) {

Of course this depends on what 0 means in the context. Generally 0 means no error, so that code would be checking for an error.
This would read "if no error":
int error = some_calculation();
if (!error) {

Use only Lisp.

>non-anime OP
>threads last 14 hours

>anime OP
>threads last 6 hours

Attached: 1566748182244.png (120x120, 11K)

How are you supposed to use vulkan? I always seen tutorials or resources using it with other things like glfw. Can you not use it on its own?

so much for the """"daily"""""" """""""programming""""""""" """""""""""""thread""""""""

>buh buh buh muhmory leaks
If you can't take care of a few lousy pointers you shouldn't call yourself a programmer. Garbage collected languages leak worse than your aberage C++ program

>Garbage collected languages leak worse than your aberage C++ program
lmfao

Have sex

Am I wasting my time learning C++, should I learn C instead?
I see a lot of C shills that say C is better.

C is for grumpy old boomers

Disregard C and Lisp shills. The only reason you get shilled is because C and Lisp users don’t actually program.

programming is for sissies
learn how to solder like a man

>don’t actually program
What do you mean?

>learn how to solder like a man
Actually I like the low level stuff but I don't want to get deprecated by automation/robotics.

In C++ you have total control of when your pointers get deleted and if you do it smartly it happens at the end of the block.
Meanwhile my C# programs have regular memory spikes that come from multi-object event bullshit or the GC deciding it doesn't feel like collecting some bitmaps, and are extremely hard to track down.
Hell, there are programs designed to find memory leaks, you set them on a C or C++ program it will tell you function f() leaks memory on line 682
If you use them on a GC program it will tell you you have an 15,000 size array of objects and it doesn't know where they came from

>What do you mean?
they just read about the features of the language, watch some videos about real-life application of the language that dont mention any weakpoint of the lang and then proceed praise it for being the way it. its literal shitposting. i know a couple of people like this irl who praise Go even thought theyve never even touched the language in their entire life and have very little expertise in programming in general

Is he a good programmer?

Attached: vitalik buterin.jpg (378x378, 17K)

just like program anime then

>user tells the word that he doesn't understand what a memory leak is
cute

with how generic and predictable slice of life anime is i guarantee this is possible with machine learning

Im trying to use Nim but cant find any decent multithreading documentation. Someone help.

github.com/juancarlospaco/nim-presentation-slides/tree/master/ejemplos/avanzado/multithread

nim-lang.org/docs/threads.html

I saw those two already. Maybe im retarded but that's not as comprehensive as i hoped.

Hi, I want to learn how to code for web development, where can I start? Are there any usefull websites as codeacademy or Code Camp? Or should I look for a book?

...

Oh it's down
well check the archive for wdg

Today is 9/9/9

Attached: 999999999.jpg (551x551, 121K)

No, I'm pretty sure it's the 10th at the moment.

t. pacific island user

hey proggy fags what is the gayest programming language?

lua

Prolog

OOP was a mistake

a gay programming language of course would be one that only reproduces through molesting children, rather than through sexual reproduction.
so, a language that gains new users through communication of mental illness instead of through production
so,
>Forth
>Haskell

>t. sub 80iq

I know!

Walking home today, some fucker bumped into me and instantly started talking shit about databases being the best type of architecture. I tried to remain calm and explain to him that Excel was actually the best architecture, but he wouldn't take a hint. He started throwing around words like “Sequel” and I lost it. Punched him right in his database loving fuck face.


I fucking hate databases

i bet you do, you filthy suit wearing management motherfucker

That's wrong, though, for two reasons.
1. Most software assumes that hardware will function normally. You can hardly blame a userland application for not working when an overheating CPU becomes unstable or a component fails. Software specifications are always conditional on hardware functioning correctly since you cannot hope to verify it as a consumer. Anyways, I fail to see how this argument applies to memory leaks but not memory safety.
2. The only reason memory leaks are safe in Rust is because they inadvertently allowed Rc and RefCell to leak and decided to run with it instead of fixing it. Core Rust with no standard library (and no mem::forget) would not be able to leak memory without unsafe.
3. Even if type systems somehow only corresponded to safety properties and not liveness properties, absence of memory leaks can be expressed as a safety property, e.g. "a live heap object shall never become unreachable". And many liveness properties are still possible to encode as safety properties. Safety and liveness are just informal categories; there's not really a fundamental separation where a property can be one or the other and not both.

You can use it headless (no WSI) for pure compute or render-to-image scenarios. You can also use your native window system (Win32, X, Wayland, etc.) using WSI directly instead of having a cross-platform library do it for you.

>wrong for two reasons
>1.
>2.
>3.
this is what defensiveness looks like.
I read that pic as supportive of Rust, anyway. "The only thing Rust doesn't do is the impossible."

>GC creates empty objects preemptively
>memory leak! MEMORY LEAK!!!!1!!!
do some research before you type

A pretty basic liveness property is termination. Many dependently typed and theorem proving languages are total. You could say that they often use syntactic checkers and other non-type-system features to guarantee totality, but what is Rust's borrow checker? Not to mention there are languages like System F which are total without any syntactic tricks.

I added another reason and forgot to update the header. The picture is supportive of Rust, it's a gigacope saying that if Rust can't do something, nothing can (falsely).

Mental illness

What gives bloggers the idea that anyone cares about their inane thoughts on X tool or Y language?

and what gives you the idea that we care about your thoughts on the said bloggers?
serious answer: normal people like to share their opinions. socializing 101, user. go outside

the same thing that compelled you to make this inane meta-post and for me to make a comment on the nature of your meta-post

There's a difference between "sharing your opinion" and writing 50 articles about build systems. People that do the latter are not normal.

a.
>has a cool thought
>"wow, that's cool!"
>"since I'm not a special snowflake with a unique, not-shared-by-anyone sense of what's cool and interesting, other people will probably enjoy this as well"
>writes about it
b.
>does anything at all
>does the needful by putting what was done in a blog
>"tech-expert ninja pro programmer tips from India"
>please be impressed and then give me a job, Google

Nice blog

50 articles about build systems?
that guy might be working on a book, and just blogging the rough draft

theres no difference between what you compared. has it ever dawned on your smooth brain that people might just enjoy doing things without any reason whatsoever? i guess some people just enjoy writing articles and sharing their thoughts/knowledge and receiving feedback about that. or just trying to get a job like user said in point B

Feedback.

he's posting about JS not rust

why would anyone use clojure when it doesn't even have condition system?

Obsessed

rent free

There are some libraries for condition systems but I haven't found the need for them yet. What do you usually use it for?

put /dpt/ in the picture and suddenly no one can find it

>used to respect my father as a programmer
>learn some programming myself
>realize he keeps saying things that are flat out wrong
>suddenly start questioning everything he has ever said to me

Attached: 1566798680958.jpg (640x640, 27K)

int main() {

//Generate Random Number 1-100
int counter;
srand(time(NULL));
counter = rand() % 100 + 1;


//Call function to create three processes
for(int i = 1; i = 0) {
if(process == 1)
{
wait(NULL);
}
else if(process == 2)
{
printf("Parent Process counter value: %d \n", cval);
}
else if(process == 3)
{
kill(getpid(),SIGKILL);
printf("Killing process with Process ID: %d", getpid());
}
exit(0);
}
}


Need to implement fork() to create 3 children. Although the parent is only supposed to wait on the first child. Anyone know why the output doesn't kill the third child?

Attached: Screen Shot 2019-09-09 at 11.20.13 AM.png (980x884, 130K)

maybe he's testing you

Why is this printing out the same node instead of moving to the next node?
// User inputs transition functions.
while (1) {
printf("\nAdd a transition function? (y/n): ");
scanf(" %c", &ans);
if (ans == 'y' || ans == 'Y') {
printf("\nInput the transition function (EX: q1,N,q2): ");
scanf(" %s", &input);
char **tranFunctSplit = malloc(sizeof(char) * 8);
char *tok = strtok(&input, ",");
int i = 0;
while (tok != NULL) {
tranFunctSplit[i] = tok;
i++;
tok = strtok(NULL, ",");
}
// Make a transition node from the user input and add it to the LL.
node = makeTransitionNode(tranFunctSplit[0], tranFunctSplit[1], tranFunctSplit[2]);
head = pushNode(head, node);
// if (head != NULL) printf("%s ", head->currentState);
// printf("%s ", node->currentState);
}
else if (ans == 'n' || ans == 'N') break;
else printf("\nPlease enter y or n.");
}
TRANSITION_T *pushNode(TRANSITION_T *head, TRANSITION_T *node) {
node->next = head;
head = node;

return head;
}
[\code]

a.
>father is speaking simply and generally for me, a child
>not knowing that child is autistic and will interpret simplification as error
b.
>father is speaking truthfully about bygone eras of computing
>ha ha stupid dad doesn't even know that bytes are always 8 bits
c.
>father is completely correct and I am actually learning stupid shit that's wrong
>lol dad had all these big-team ideas about programming but look at me I can do everything as a single programmer with Haskell

pic related is output

Attached: shit.png (497x351, 13K)

>//Parent
>else if (pid >= 0)
>kill(getpid()
>why doesn't it kill the child?
try killing pid sinstead of getpid()

He said that he does not like C because it has a garbage collector
I had to show him three different articles until he believed me that it does not have one

faster debugging

Looks like you backed the wrong horse

>father isn't a cnile
>father worked for a living and knows a productive language very well instead of being filled with endless factoids about endless memelangs
this is probably a good thing. Who cares about his wrong beliefs about shitty languages? Ask him about what he knows about languages he actually uses.

Would you still need it if all your data were immutable?

Can someone give me an example of using regex.h? I need only to know whether the passed string matches with the passed regex, not exactly how.

Attached: 1564905013730.jpg (1280x1811, 204K)