/dpt/ - Daily Programming Thread

What are you working on, Sup Forums?

Previous thread:

Other urls found in this thread:

youtube.com/watch?v=endKC3fDxqs&index=17&list=PL3jwVPmk_PRxo23yyoc0Ip_cP3-rCm7eB
dlang.org/orgs-using-d.html
twitter.com/SFWRedditImages

Learning C++

where is akari user
why is the board down

D sucks Dick.

Reading K&R

That's not a bad thing

whats wrong with my shitty c bit code it prints 0001110100 when i expect 0001101010

void printbits(int number){
char lol[10] = "0000000000";
for(int i = 0; i < 8; i++){
if((number & (int)pow(i,2)) != 0){
lol[i] = '1';

}

printf("%s\n",lol);
}
}

C++ is a horrible language. It's made more horrible by the fact that substandard programmers use it.

Writing an ultra secure decentralized communications protocol.

Why dont you like it, lad?

pow(2,i)

i dunno how u can even help me i just noticed how eternal shitty that code is but thanks friend

>watch a programming talk by a guy
>its most always technical to some degree an informative

>watch one with a girl
>it always just sounds like a sales pitch and they rarely show any actual programming

Are there any decent womeme talks, /dpt/?

women dont really care about programming, they just think of it as a way to gain male fans (ohhh shes so smurt!!) and money from donations / shitty ruby / JS code.

what is Sup Forums's opinion on using namespace X

>C++
Instant trash

Namespaces are awful.
Use a language with modules.

youtube.com/watch?v=endKC3fDxqs&index=17&list=PL3jwVPmk_PRxo23yyoc0Ip_cP3-rCm7eB

Yeah, this one surprised me desu, andrei's protege was nice to listen to.

Namespaces are good, but modules and namespaces together are better.

Yes it is. The language looks promising in terms of syntax and what it can do but then that gets blown away because it has really poor debugging methods. Turns the language into a simple toy.

Debugging D is awful. There really is no standard "out of the box" way to debug code like in C or Java that just work. D has a random mix of debuggers that either do a poor job of debugging or can't debug at all. This really hold the language back in my opinion.

How do you dereference variables when calling commands in bash?
var="dicks"
output=$( some shit | awk '("$2" == "$var") { print $3 }' )


I did it using eval but I hear it's bad practice to use it.

modules make namespaces redundant.

>DConf
How many funerals does this language need?

>still using a scripting language in current year

What if you need to define a new namespace inside a module?

must be popular in europe

>D has a random mix of debuggers that either do a poor job of debugging or can't debug at all
Thats true i suppose. You might look into the Linux version of Coedit if you care enough. They have a nice front-end.

Ive found that taking a functional approach with D rarely has me needing a use beyond some sparse writeln though.

Real men don't need debugging

>the rustfags are getting nervous
isn't it time for you to take your estrogen?

protip: use tee

I don't use Rust.

Pretty sure it's a pooinlua tard

Np. You can also do 1

>float point indexing

the std.range.tee?
Havent found a use for it yet but i probably will eventually

Absolutely disgusting

If you are chaining functions you can use tee in the middle of anything to see where it's going

>paranoia
SHE'S DEAD, JIM

>indexing starts with 1

You mean 1.0

Stop bullying Lua, it's a nice scripting language

In lua 5.3 they added integers.

>LOO-uh
>Nice
Good meme, I laughed

Id rather just keep a local debug block instead of having to modify actual things. But it seems handy, its just i rarely abuse UFCS enough to lose track.

>It took them 5 versions at minimum to realize this
kek

What do you expect from skid shit?

this is actually horrible

Lua was never meant to be taken seriously

Holy fucking shit dat autism OP pic.

that pictures probably atleast half your age.

Best place to learn C#?
Will codeacademy ever do C#?

First question, why C#?

>Ive found that taking a functional approach with D rarely has me needing a use beyond some sparse writeln though.
It is a bit off putting though. Rolling with print statements is limiting vs procedural line by line examination of the logic. Why does it have to be this way...

But I don't want to create shitty code. I want a way to double check my logic and fix whats broken because I know I'm bound to fuck shit up.

I've finally got the supporting code in place for my Discord bot written in [spoiler] D [/spoiler].

You can define commands that match on patterns in the messages that users send by writing functions and tagging them with custom attributes in a separate module. You then pass that module name to a function that automatically imports your module, loops over all the declarations tagged with @Command or @Pattern and generates the code to look for the patterns you've defined. If your command isn't very complicated you don't even have to specify the pattern to look for; if you leave it out it will use the function name as the pattern. Writing a command is very simple:

@Command
string ping()
{
return "pong";
}

@Command("press f to pay respects")
string payRespects()
{
return "f :pray:";
}

import std.regex;

@Command(`(^say)\s+(.+)`)
string say(Captures!string captures)
{
return captures[2];
}


I have to say that I really like how powerful D is. It seems like there's either a tool for everything you'd need or you can easily create one.

Code academy will give you a basic introduction to logic, which in your case is far more important.

JAVA

>But I don't want to create shitty code
Don't create them
> want a way to double check my logic
Do it yourself, does one need to hold your hand?

Need to move up from scripting, I already know python. Want to make games for fun.

Whats a good place to find the basics to C? I need to revise it for my class, forgot all about it

>Why does it have to be this way...
Well VS Code + GDB + native D stacktracing work well enough.
If no one gets to it by then, its like the fourth thing down on my project list.
But you should definitely look into soft-functional in your language of choice. It really cuts back on a lot of debugging.

If only any other programming language in wide use could claim the same..

> I already know python
Have you tried Nim?

Java is only useful for cross platform distrubution without re-compilation.

Lisp? It doesn't really seem that widely used.

K&R

>D
>wide use

Basics of C? Can you write imperative code?? I'd have other concerns if I was you.

D has wchars though?

dlang.org/orgs-using-d.html

There's more tutorials for unity. Trying to move away from python.

Whoops, forgot a picture of it in action.

It's actually a pretty well made language overall though, the community is just corporate crap.

Now make it autonomously shitpost and then make a new bot that tries to moderate that one.

Amazing, almost as good as the ruby on rails app I farted out while I was drunk.

kek

Yeah, it's really well made and a great language... besides the type system being unsound.

It's not the end product, it's the journey. I've never done anything like this before so it was a great learning experience.

how the fuck do you guys come up with this shit? did you just think "oh hmm a discord bot. that would be interesting. also I like the D language. I guess I'll get to work!".
meanwhile I'm sitting here for hours trying to think of anything interesting to write and all I can think of is stupid shit like todo lists and emulators

You're right. Other people have steel, you chose tin.

> D

And deliberately avoided making an alloy out of it. Enjoy your tin.

With the risk of shitting up the thread;
Am I the only one who found programming having become more enjoyable since switching from Java to C#?


> Finding resources is a lot easier because the language doesn't encourage writing factoryFactories and other retarded shit, so the code snippets you find are short and to the point

> .NET was seemingly developed by people with a brain, so shit like file system iteration can be done with one command rather than 35 lines of object iteration, this also fits into the above: a lot less shit code to be found

> Networking is a lot less shit because you don't have to bitshift every single piece of data into a larger signed variety. A uint32 is a uint32, not a int64

> Don't have to write batch or sh scripts to run the program you just made, making it a lot easier to publish

> It's just as cross-platform as Java with .NetCore and Mono, so you don't have to worry about gays and aspergers not being able to run it

> Its primary IDE has amazing debugging and does actually not eat up 16GB of ram and 4 CPU cores from just trying to code completion


I know of the
> Microsoft
meme, which is why I avoided C# to begin with, but now that I've actually started using it, holy shit why didn't I switch sooner.

What does that supposed to mean?

>stupid shit like todo lists and emulators
>emulators
emus teach you alot though

trying to make gui in ubuntu with c++ and how do i solve this? sry for retarded question i only ever make gui in win api

Well, I had special motivation for getting this to work as I wanted to write a bot that monitors a friend's twitter for new tweets and automatically posts them to a private discord channel so me and some friends can make fun of him (he thinks he's a big e-celeb and posts the gayest shit. He is also in this discord channel). This is just the discord side of things. I recently created a command that can scrape google for images as practice for scraping his twitter feed for tweets.

i love how flustered brainlets get when D gets brought up

>>D is dead
>omg rust shill
>Wtf no it isnt [obsecure company using D]
>holy shit wtf
Yeah, those D brainlets really get flustered when they try to bring that corpse back from the dead

It's not surprising. The C# language is what Java wants to be when it matures.

>writing programs to automatically troll your friends
You're doing good.

D is automatically infinitely better than Rust because it's not associated with trannies and other SJW shit.

yeah but literally nobody gives a fuck. It's not special. you can't sell it, because lets face it no emulator an amateur programmer makes is going to compete with professionally made emulators.
employers only care about things you made that have some value. there are thousands of emulators out there.

I wish D fags and Rust fags got along

I don't care about Rust

What a coincidence, neither do I.

I enjoy it when they fight it out. I enjoy when they fight it out, thinking that they are the superior language when I just down on them as I know that C is the superior language. Long live C!

/dpt/ how do I use ADT to do trait?

Suppose I am writing game in pure functional language

I am need game object. One of few legitimate use case for object oriented programing

Simple enough just express object state as algebraic expression of types and create alias to said expression

BUT THEN!!!!!!!!!!!!

I am need something like inheritence in order to expressing many rich diversity of game object

Consider situation!:
Have the objects
* Some game object are solid
* Some are stationary
* Some are both but not all that either is both
* Some are control by player
* Some are UI abstraction
* Some are pickup to restore stat, endow ability, etc
* Some are enemy
* Some are walk on land
* Some are fly
* Some are siwm
* Some are affect of gravity and physic
* Some are have more simplerudimentary scheme of move
* ALL have many different overload for interactbehave! Behave are be construct from what?? From what list above!
* AND YET!!!!!!: ALL are game object!

Obvious need for trait. But how do?

>>>I don't care about Rust
>>D is shit
>Wtf rustfag

Let's face it, D is as shit as Rust

>C
>Frogposter
instant brainlet

Diversity should be avoided at all costs.
What constitutes a "game object"?
Consider existentially quantified types

What makes you say that?

Actually the superior language is electrical engineering.
For any program you can write in C it is possible to wire up a circuit that achieves the same result much more quickly and efficiently, without relying on anything even resembling a processor