/dpt/ - Daily Programming Thread

What are you working on, Sup Forums?

Old thread:

Other urls found in this thread:

tour.golang.org
golang-book.com
en.wikipedia.org/wiki/Application_binary_interface
wikiwand.com/en/Application_binary_interface
blog.plan99.net/modern-garbage-collection-911ef4f8bd8e
qr.ae/drvVS
qr.ae/drvm8
yager.io/programming/go.html
nomad.so/2015/03/why-gos-design-is-a-disservice-to-intelligent-programmers/
java.dzone.com/news/i-don’t-much-get-go
dtrace.org/blogs/wesolows/2014/12/29/golang-is-trash/
lessonsoffailure.com/software/google-go-not-getting-us-anywhere/
lessonsoffailure.com/software/googles-go-not-getting-us-anywhere-part-2/
lessonsoffailure.com/software/google-go-good-for-nothing/
gist.github.com/kachayev/21e7fe149bc5ae0bd878
yuki.la/g/50006496#p50011157
youtube.com/watch?v=1CpjRMICXNM
youtube.com/watch?v=IIAWs3_Hgtc
stroustrup.com/books.html
sprunge.us/iOKj?c
youtube.com/cource?list=ECE18841CABEA24090
cs.brown.edu/courses/cs173/2012/book/
users.dcc.uchile.cl/~etanter/ooplai/
youtube.com/watch?v=2Op3QLzMgSY&list=PL8FE88AA54363BC46&index=1
paste.lisp.org/display/313070//raw
github.com/golang/go/wiki/Projects
github.com/avelino/awesome-go
github.com/mitchellh/gox
youtube.com/watch?v=3U3lV5VPmOU
twitter.com/NSFWRedditGif

We are absolutely in agreement.
Personally I would side against overloading operators unless the meaning is intuitively obvious, e.g. +-*/ for arithmetic classes and [] for container classes. As soon as you have to ask "what does this mean for this class...?" then you're doing it wrong, because operators ideally have a globally consistent meaning.

writing a VST synthesizer using rust
i-i have done it. i have become faggot.

>Rustacean
I get having a CoC and forcing niceness. I get not being 100% serious in your docs. But stop with this shit in the official manual, for fuck's sake.

Today I learned Rust has a pseudo-goto in the form of break label. You can add a label to a loop to allow break to exit out of an inner loop. Combined with using RAII for deterministic cleanup of resources upon an error, Rust has effectively eliminated every legitimate need for a goto using other language constructs.

what about code generation using rust as an IL?

>he isn't a crab
you literally don't even belong here

fug u

If you're looking to use another programming language as an intermediary language, I'd recommend not using Rust. Presumably, the compiler you are using to generate the IL will always produce correct code, so using a language with an advanced type checker will only slow down compilation time (the type checking should be done in the language you are transpiling to C). Moreover, Rust only supports as many platforms as LLVM does, while C supports at least as many targets as LLVM does, with compilers on other platforms as well.

for a quick n dirty DSL, typechecking in the target language might be more time effective.

Go > *
tour.golang.org
golang-book.com

pic unrelated

thanks for posting my waifu

How can one write a program in multiple languages at once?
I mean, how can components written in different languages talk with each other?
excuse my retarded question, I only know java

lol no generics

shit gc

en.wikipedia.org/wiki/Application_binary_interface

/dpt/-chan, daisuki~

Ask your much beloved programming literate anything (IAMA)

wikiwand.com/en/Application_binary_interface

blog.plan99.net/modern-garbage-collection-911ef4f8bd8e
qr.ae/drvVS
qr.ae/drvm8
yager.io/programming/go.html
nomad.so/2015/03/why-gos-design-is-a-disservice-to-intelligent-programmers/
java.dzone.com/news/i-don’t-much-get-go
dtrace.org/blogs/wesolows/2014/12/29/golang-is-trash/
lessonsoffailure.com/software/google-go-not-getting-us-anywhere/
lessonsoffailure.com/software/googles-go-not-getting-us-anywhere-part-2/
lessonsoffailure.com/software/google-go-good-for-nothing/
gist.github.com/kachayev/21e7fe149bc5ae0bd878

Go Go: 33.553163084 seconds time elapsed
Go gccgo: 17.438276362 seconds time elapsed

C++ clang++: 5.518077517 seconds time elapsed
C++ G++: 4.659448453 seconds time elapsed

Rust rustc: 6.583698221 seconds time elapsed

Haskell GHC: 0.454930841 seconds time elapsed

Java OpenJDK: 1.189619693 seconds time elapsed


but llvm as backends that compile to c or javascript.

Thank you for using an anime image.

Continuation from (posted 5 mins before thread died).
Does anyone here have any experience in going from OOP -> DOD?
In which case, do you have any tips or experiences you'd like to share?

Context:
I'm a C++ game dev, that has recently taken an interest in trying an entity system rather than the conventional component-based design.

Just to annoy you guys, I intentionally added a goto into the SW project I’m currently working on. For the first time in my life. It was a very peculiar feeling, like shitting on the desk. (hmm… haven’t tried that yet) My fingers are still trembling, I feel guilty and depressed. I lost something, I’m not myself anymore, my guilt is chasing me. I believe they’re watching me during coding. Heard some strange remarks about me around the coffee machine, they probably know it. Trying to act normal, but it’s probably written on my face. I’m afraid that my boss will see that code and tells me down in front of the team. I would not survive that. Probably will be called “the goto guy” in the rest of my life. Not sure whether I can carry this weight, I regret doing that in the same minute. I wish I could change history, but it’s already committed. Everytime I open Mercurial, I get shocked by that change set with the ugly goto, like touching high voltage.

It seems that the only way out is setjmp.h. That would end the pain and I could be free again. I don’t want to be the average conformist coder, adding auxiliary variables to keep the state or restructuring all those five code lines, just to make my manager happy. I’m not broken yet, I still have self esteem. Probably if I add some Inline assembler, they won’t notice the goto…

>Just to annoy you guys

not like we give a shit, you're the one that will have to maintain it

I can't think of any reason why you'd get a speedup using another language's type checker, but I can think of a practical reason why not to. Namely, that a type checker is supposed to be a sign of code that is broken. How can you know what is wrong with your own program if the error message is in code generated by the compiler?

>conventional component-based design.
???

is that anime called shogun?
also is it worth a watch looks neat but that dude in red kinda looks homo. Im lookin for some action not gay shit.

>gist.github.com/kachayev/21e7fe149bc5ae0bd878
lol, did you even read this?
>muh Promises
this retard doesn't even know how to use the tools the language gives him... and then, feels the need to criticize it

>Go Go: 33.553163084 seconds time elapsed
>Go gccgo: 17.438276362 seconds time elapsed
>yuki.la/g/50006496#p50011157
>2015
discarded

great job, faggot

>I can't think of any reason why you'd get a speedup using another language's type checker
I mean in development/prototyping time of the DSL itself.

>How can you know what is wrong with your own program if the error message is in code generated by the compiler?
Again, this is in no way an optimal way to make a DSL, but

$ dslc file.dsl
... rust error ...
on line 882:
rust line; //file.dsl: line 223

solid arity!

>yuki.la
>not warosu

this is a cute smug akarin

>inb4 all akarins are cute

kys degenerate weeboo

>doesn't like anime
>visits Sup Forums

i dont want to kiss you

alright you get it back for this shit

got ' em

>I mean in development/prototyping time of the DSL itself.
Perhaps, but I'd figure if you want to make a DSL people would like to use, it might make more sense to put a little more effort into designing it, especially if performance is so relevant to its usage that it needs to be compiled, rather than interpreted or embedded within another language.

>Again, this is in no way an optimal way to make a DSL, but
Eh, I suppose you could do things like that, but it wouldn't be able to give you a detailed reason for the error.

I just took a close look at D. Having done that I really, really wish it had taken off instead of Java. It looks absolutely wonderful, too bad that it's dead.

const gf = false;

if (gf) {
console.log('tfw no gf');
}

not braindead enough for the pajeets of the world.

>my first day at uni
>already dreams in binary
-you

So only say "tfw no gf" if you already have a gf?

>apostrophes for delimiting strings
why do people do this

I'm not sure what you're asking, but if you don't know what I mean by "conventional component-based design", I'm simply talking about a Component system.

In a component system, the functionality of game objects are split up into smaller components, that are then have to be attached to this empty shell. This is, for example, what the unity engine is based on.

An ECS, or an Entity System simply takes this a bit further by being more data centric and maximising the efficiency of the cache. (( though there are obvious downsides, such as a lack of abstraction and difficulty debugging etc.))

It's nice in certain scripting languages e.g. PHP where funny things happen to double-quoted strings.

this does the opposite of what you think it does.

In Ruby, single quoted strings are faster to parse, because you can't do string interpolation with them, and most escape sequences are more or less interpreted literally.

Obvious bait is obvious.

>faster to parse
gotta save those microseconds

(let ((f (lambda (g) (call-with-current-continuation g)))) (f f))

Low-level language trying to be high level.

((let/cc cc cc) (let/cc cc cc))

>C++
youtube.com/watch?v=1CpjRMICXNM

>python
youtube.com/watch?v=IIAWs3_Hgtc

So, what should I read after SICP?

stroustrup.com/books.html

>fgets() includes '\n'.
Here you go senpai sprunge.us/iOKj?c

Does anyone know what's the font in this picture?

>that picture
NO.
FUCK YOU.
I'M DOWNLOADING SICP, ACTUALLY READING IT UNLIKE YOU SEEM TO THINK, LEARNING THE WHOLE THING RIGHT HERE AT HOME WITHOUT A PENCIL OR PAPER WHILE PLAYING ON MY CELLPHONE, AND APPLYING MY LEARNING IN A USEFUL WAY WITHOUT GETTING A JOB.

That youtube link doesn't work (unless I made a mistake when copying it): youtube.com/cource?list=ECE18841CABEA24090
It's Error 404.

cs.brown.edu/courses/cs173/2012/book/
users.dcc.uchile.cl/~etanter/ooplai/

TAOCP

youtube.com/watch?v=2Op3QLzMgSY&list=PL8FE88AA54363BC46&index=1

How do I catch an exception from an if statement?

if (a.toInt() == 0)

and my toInt throws an exception.

You wrap the whole if block -- then and else clauses included -- in a try block.

paste.lisp.org/display/313070//raw

I got it and I feel stupid for asking. Thanks.

What is Go good for? I mean I've learned the language but I haven't found anything I'd use it over anything else.

How is Rust for cross-compiling non-trivial projects these days?

e.g. what if I need to

>compile one part of the project to a linux executable
>use that linux executable to transform some data
>compile another part of the project to a windows executable, linking it with the transformed data

...

It's for when you would want to use java but you don't want to have all the great libraries of jvm.
There's really nothing special about it other than it lack lot of features.
There's better alternatives for it: D, Ocaml, (java, c#), Chapel. Even nim seems that it fills the Go's niche better than go.

Really you should just use CL if you're not good enough to use a decent type system and you don't need C-like performance.

github.com/golang/go/wiki/Projects
github.com/avelino/awesome-go

dunno about Rust (it's supposed to be easy to do, AFAIU), but at least in Go, you can do this easily
there is gox, but you don't really need it to cross compile:
github.com/mitchellh/gox

>Go's niche
and what is Go's niche, Pajeet?

oh, and btw, one of the best features are:
- fast compile times
- CSP
- multiple arches support
it's mostly orientated to system/web backends stuff. the libs and docs are very nice

Go's niche is Pajeet, Pajeet.

>Scheme
>Low-level language trying to be high level
Low-level wizard trying to be high level

Lol Guido. How did he find out what they meant by sending him the book?

>all of this effort spent on such an abysmal language
Mankind is unworthy of salvation.

Really you should just use C if you're not good enough not to need an excessively restrictive type system and you don't need CL-like performance.

Go is the language Rust tried to be and failed. It's the successor to C we were always waiting for.
It makes programming great again.

>C
>type system
lol

>It's the successor to C
But it's GC and slower than C++??? Gofags on suicide watch???

>not to need an excessively restrictive type system

T without(T)(T[] args, T target)
in
{
assert(args.length > 1);
}
out
{
assert([12, 23, 23, 11, 0, 23].without(23) == [12, 11, 0]);
assert("ccxi".without('x') == "cci");
assert("abcderfiibcne".without("bc") == "aderfiine");
}
body
{
T[] result;
//To-Do
return result;
}

Another question regarding this, how do I make it check the next statement if the first 'if'' throws an exception?

Currently I have
[CODE]
try {
if (a.toInt() == 0)
return 1;
if (b.toInt() == 0)
return 2;
if .....
} catch (Exception e) {
return 0;
}
but it throws in "if (a.toInt() == 0)"
[/CODE]

what effort? it's so easy to learn and do stuff with it, it doesn't even feel like effort or time wasted, at all

>Go is the language Rust tried to be and failed
That's very much wrong

>he thinks a type system is about restriction
This is how I know you've never used a good one.

Beside the point. The point is, like I said, that no good programmer needs a type system anyway, and certainly no good programmer needs C's sad excuse for one.

Sorry for my retardation in formatting.

>not good enough not to need an excessively restrictive type system
double negative, bitches!

If you can't use any bound identifier freely in any context with no extra syntax, the type system is excessively restrictive.

If you want to do different things depending on where the exception is thrown, you need separate try blocks.

Go uses a revolutionary new GC with the smallest pause times of any in the world, and its design minimizes garbage creation in the first place, so it barely needs to run. And unlike other languages, Go gets faster with every version.

When will go get generics?

I mean it's not going to be able to get into the big boys' club like Rust did, but I think it'd be pretty nice if I were able to write Go for android instead of Java

Again with the restriction meme. I suggest you watch this talk: youtube.com/watch?v=3U3lV5VPmOU

Ruby can you be my personal programming senpai? I'm already into a different degree and I can't afford starting all over.

Can't, I'm at the hospital. But it's not a meme, if not everything is an expression then the language is shit.

I too like to subtract text from my numbers.

Bump, how would you approach this?

If Go is such a good garbage collector then why doesn't it collect itself?

Generics are a mistake and the world is starting to understand this and turn away from them.

The usual argument for generics is to avoid writing "boilerplate." But understanding the details of how the code actually executes is vitally important to understanding what the program does. The aversion to working with it is simply a cargo cult. Writing it out by hand, you'll soon realize, is refreshing and rewarding.

>T
instant shit language

1/10