/dpt/ - Daily Programming Thread

What are you working on, Sup Forums?

Old thread:

Other urls found in this thread:

hwaci.com/sw/mkhdr/makeheaders.html
twitter.com/SFWRedditGifs

S2 HYPE

Umaru~

Should I buy programming socks?

>3 posts too early
Delete your life, umaru fag

dubs decides my next project

>What are you working on, Sup Forums?
I'm cleaning my apartment.

More specifically, I'm throwing away stuff I don't need and trying to rearrange stuff so I can put stuff in the basement storage.

Minimalism 4 lyf

Umaru killing simulator

n.b. you are killing umaru and not the other way around

4HC - Sup Forums haskell compiler

Rewrite the Linux kernel in Javascript.

an IoT ass-dildo

winrar

neat

I'll make the logo.

I'm lost trying to figure out a bug in my VM.

Hey Sup Forums, why do we still write C/C++ header files by hand? why not generate them automatically based on the main file as part of compilation? It duplicates work, but maybe there's a reason I'm missing?

Say the rules for generating headers are like so:
- if you see a function declaration or definition and it's not static, copy its prototype in your output.
- if you see a global variable that's not static, add extern and output it, same thing.
- if you see an inline function definition, output it in its entirety.
- if you see a C++ class, change the method definitions into declaration if they're not inline, then output.
- for macros, dunno, maybe we should have a separate header file for those?
- if the main file is including headers, maybe include them, idk but there's probably a 99.9% of the real-world cases solution.

thoughts?

> started as a joke
> will end up the most bought sex toy thanks to cam girls

lol who uses c languages

versions already exist that vibrate a certain amount depending on the size of the tips on chaturbate and other cam websites

Can you recommend me some challenging programming books?
I mean, something like SICP, not CS degree tier but difficult enough to be intellectually stimulating

cracking the coding interview?

so, introductory books?

For one thing, there are quite a lot of things which exist only in the headers, like struct or enum definitions, or preprocessor stuff like macros.

For another thing, there are lots of projects (Linux being among them) that don't have a 1:1 correspondence between C files and header files, but instead actually group definitions according to what you may want to include into a certain C file.

Given those objections along with the fact that maintaining the duplicated portions is an issue of very straight copy-and-paste, and also that it doesn't really happen that very often, it's understandable that noone has bothered to produce a potentially quite complex solution to an almost non-problem.

I'm new to programming, what are the basic memes that I should be aware about it.

Classes in Python are kicking my ass, Sup Forums.
OOP is fucking gay.

Elements of programming interviews is better imo

iteratives is more simple to understand than functional

C and Haskell are good tier
Rust is meme tier

"""""apps""""""

>python
>OOP

You have no understanding of C. The preprocessor runs as a separate step that modifies the source code before it gets compiled.

Yes?
I'm just an hobbyist bro

Any good resources on LuaJIT?
Gonna need to write some nginx modules/extensions soon, need to read up on it.

Did you reply to the wrong person?

It was originally called OOPs programming but they changed it for obvious reasons

Nice of you to include Pajeet in the bottom left

OOP and web development

A pantie remover for Umaru

There are far more Indians in your area than you thought

What the fuck is the point of OOP? Is it even necessary? Seems like it's just a bunch of bullshit made to confuse the fuck out of people.

OOP is synonymous with code reuse. Without OOP, you are forced to copy and paste the same code, or worse, retype it and maybe get it wrong.

It came around at a time when program/system complexity was much less of an everyday issue, and programming was still trying to figure out how to be "sexy" and "expressive"

Now, of course, we've realized the mistake but it's too late, the damage is done.

To simluate the real world. For instance: you can call deposited and withdraw on BankAccount.

To keep managers employed

>Without OOP, you are forced to copy and paste the same code, or worse, retype it and maybe get it wrong
Are you retarded? Do you know what a function is?

>Hey Sup Forums, why do we still write C/C++ header files by hand?

Because those languages came from a different era. Sane people already moved on.

There was no such thing as polymorphic functions before OOP.

2/10, almost thought you weren't trolling

r8 my Aarch64 (ARM 64 bit assembly)
.text
.globl _start

_start:
mov x3, 4
ldr w1, uart
ldr w2, =message
//load byte into w3, increment message, print, repeat
b loop

loop:
ldrb w3,[x2]
strb w3,[x1]
cbz w3, finish
add w2,w2,1
b loop

finish:
b .

uart: .int 0x09000000
message: .asciz "niggers tongue my anus"

You couldn't be more wrong. Thanks to OOP we now have thousands of people who copy their code and get it wrong.

What's with the hate on Javascript? Any language sucks if you write shitty code, it's popular for a reason

In theory, makes larger projects easier to be controlled and harder to fuck everything up.

see:
people in software loves to talk about code reuse but nobody reuses shit, hence, a meme

JS is the only option for web. That's why it's so popular.

Because you can only write shitty code in JS

If a unicycle is the only way of transport, everyone would ride one.

Rate my javascript

var Y = function(proc) {
return (function(x) {
return proc(function(y) { return (x(x))(y);});
})(function(x) {
return proc(function(y) { return (x(x))(y);});
});
};

Well, you can withdraw loads of things, it doesn't really make OPP appropriate.
This would be handled by associating some data with an action. i.e interface.
OOP gives us much more bloat: Polymorphism, inheritance.
These don't really make sense alot of the time, and that's why we are seeing the push to things like 'composition over inheritance'.
This is essentially data containing data, nested objects instead of inheritance.
OOP isn't really a good representation of the real world, althought I'm not aware of a better alternative.

Writing code without objects leads to 4000+ line long as fuck files that do 180 different things each. Spaghetti code basically. It's a fucking nightmare to debug. It's complex and fragile.

What is FP?

10/10 kek'd

I never said OOP was a good thing. I only told you what OOP is.
My problem with OOP is that data and logic are fused into one thing: a class.

It's new paradigm that will take a while to be a substitute

Turing machines were a mistake
Lambda calculus was robbed

now we're talking

FP was here before OOP. It's not new.

I STILL don't understand how the mixing of state and behavior that uses that state into a class unit is a bad thing.

...

Make your program multi threaded and you'll know.

what is synchronization? what are singletons? what are static variables / functions?

>Lambda calculus
Which one of them are you referring to?

I want to write a personal assistant AI that isn't utter shit (Cortana and Siri and others)
How do? Where do I go to learn the stuff? Any links or resources to recommend?

the church of Church

All of them, the mistake was the acceptance of a (necessarily stateful) machine as a model rather than modeling by processes

Hello, world!

>All of them
Most of them are fucking garbage. I need more specifics.

What is it?

did you ever made a multi threaded program in your life?

Know of any good languages that use objects without the inheritance shit?

vid related

>good languages that use objects
Impossible.

Fine, then typed. But the important distinction is turing machine vs lambda calculus, despite their equivalence

just dont do multiple inheritance and only go one level deep.

A virtual machine implementing an ISA I came up with. See for telnet output.

>For one thing, there are quite a lot of things which exist only in the headers, like struct or enum definitions, or preprocessor stuff like macros.
There's nothing special about headers, the same declaration has the same effect if it's read directly from the .c file. What I'm proposing is to move all that into the .c file, have it *not* include its own .h file, and have the .h file contain the relevant info to be included by other .c files in the project. This avoids some repetition and even gives a nicer look to C++ files: would you rather have
class something {
int some_attr;
void somemethod() {
...
}
}
or
void something::somemethod() {
}
and need to lookup attributes in the .h? The traditional approach seems kind of btfo there.

>For another thing, there are lots of projects (Linux being among them) that don't have a 1:1 correspondence between C files and header files, but instead actually group definitions according to what you may want to include into a certain C file
Yes maybe, grouping declarations is meaningful, especially given that C has no namespaces.

My question is why has is no one using and contributing to hwaci.com/sw/mkhdr/makeheaders.html or doing any thinking-outside-the-box ? That program seems to have a different model than I do tho.

>Given those objections along with the fact that maintaining the duplicated portions is an issue of very straight copy-and-paste, and also that it doesn't really happen that very often, it's understandable that noone has bothered to produce a potentially quite complex solution to an almost non-problem.
That's cause people are forgiving. Copy pasting is bad and should be done via #include directives or another abstract process. DRY. Period. Also that solution is called pretty much any other compiled language: I'm sure they have a compilation step that involves extracting declaration from source files in order to resolve references in other files.

>Fine, then typed.
Which one though? A lot of them are pretty bad.
>despite their equivalence
Any good lambda calculus isn't Turing complete.

>synchronization
Absolute shit.
>singletons
>static variables / functions
Pay attention in class kid.

>supposed to be learning python for this dumb class but can't stop reading about lambda calculus and turing machines and FP and shit
fuck you /dpt/

try to write the most functional python ever

Any language that doesn't allow functions in data structures. So most functional programming languages.

of course a smug snarky answer as a reply. yes I've made / worked on several "mutli-threaded" programs in popular OOP languages. so tell me - how is synchronization a problem when there are many ways to deal with it?

continued
>I'm sure they have a compilation step that involves extracting declaration from source files in order to resolve references in other files
But one of them doesn't. Can you guess which? You're right, it's haskell ! When files have cyclical references, you need to write some sort of fucking header file yourself. Not kidding

Which typed lambda calculus would you say isn't bad then and why? I've reached the limits of my understanding necessary to continue talking out my ass

>Absolute shit
why?
>Pay attention in class kid.
how about you explain yourself instead of resorting to shitty insults.

infinitely parallel operations will be nearly impossible to implement in stateful languages

porque no los dos?
aka the most inefficient python ever

Any typed lambda calculus would be fine assuming it doesn't have general recursion (no Y or omega combinator and no fixpoint bullshit).

>why?
Threads will wait to acquire a lock on the reasource. In the mean time, they just sit there doing nothing. So you eventually run out of threads in your thread pool.

nvm, you're clearly a genius, i cannot argue. Why you don't just program straghit in binary code since you are so secure to rely on static variables to do multi threading

Never warmed to Haskell because of the lack of state. Computers are inherently state based, so I never really understood the concept to the point that I could implement useful shit in it.