/dpt/ - Daily Programming Thread

What are you working on, Jow Forums?

Previous thread:

Attached: the_donald.jpg (200x250, 11K)

Other urls found in this thread:

pdfs.semanticscholar.org/b57a/af581e043fb63c56ebd662720190e3121220.pdf
stackoverflow.com/questions/14917952
twitter.com/AnonBabble

Thank you for using an anime image.

First for the best PL:

What programming language will make me happy

Haskell

ur mums : is best PL

javascript is pure trash. a half-baked attempt of a language.

how did it ever become industry standard?

modern js is pretty neat
lang itself, tools, engine are all fine

If C++ doesn't make you happy, no language will.

Everyone knows the best PL is for bakas

Attached: ad4ff063b16d0afa3eef6c7ad2ab4d03.jpg (600x750, 135K)

how to create a new uml java platform model in netbeans?
I dont have it as an option in home pc but it is in university.
I tried searching the plugin and found easyUML but it's not the same thing.

Is C++ a cancer?

cirno is the strongest programmer

Can you use VLAs in conjunction with TCO to completely eliminate any need for heap allocation?
#include
void readfile(FILE *fin, char buf[], int bufsize,
void (*callback)(char buf[], int bufsize)) {
int i, c, n = bufsize

Why are there so many women at work ? I fucking can't focus !
I wasn't taught this shit at school.

just look at the syntax and tell me

>how did it ever become industry standard?
There is something about 'Java'.

That's C.

Clojure

Cniles BTFO by Cniles

Can I write different parts of a program in different languages? How?

More specifically: I have a smal library I wrote in C++. Can I write a C wrapper for it and use it in a C program?

COBOL

FFI. Just use languages that support cdecl

Emacs :
Easy to learn, and intuitive keybinding for tons of function
If you didn't like it, you can modify it to your taste, and if you are lucky somebody else already done that and share their script for you

Most text editor:
weird keybind
Doesn't allow you to modify it

>lisp is easy to learn
yeah

Can you dumb that down a bit for me?

post a screenshot of your code

Attached: scrot.png (878x721, 122K)

Really need to get back to Emacs, I bloody hate all that shit

JVM as a language substrate is a fucking retarded idea anyway, the semantics of JVM bytecode is far too tightly coupled to that of Java itself.
CLR's much better for it in every technical respect. First class support for dynamic typing, value types and unmanaged types mean you don't have to jump through hoops like Clojure does.

Emacs is a pain. Rather write my own editor than use it to be honest.

Idris

I am not lucky and who even uses keybinds when code templates exist for reasons other than Copy-Paste-Cut-Build-Run?

I don't want to modify it. I want it to perfrectly suit my tastes out of the box.

FFI is how languages talk to each other. It means foreign function interface.
Most languages support a C FFI.
C++ has a pretty C FFI, you need to use extern "C"

t. shit perf runtime

How do i use extern "C" to call C++ functions from C code?

Remind me again, which language sees more industry use:
F# or Clojure+Kotlin+Scala?

Rust

I, too, want an unicorn
but whaddyaknow, we've got to make due with mules or extremely trainable horses

The one that's portable and sees support on multiple platforms.

Why do people suck Edwin Brady off so much in here by constantly suggesting Idris? It's a flaming trash heap of a language that attempts to be a half way point between Haskell and a theorem prover instead of (more reasonably) just being a dependently typed programming language.

HolyC, Terry believes programming should be fun

That's why I'm learning programing in the first place, so I can build a unicorn.

C++ and C have good compatibility. Just use extern C and wrap all class functions you wish to expose plus create and destroy for the object.
You have to create an opaque type (struct) for the class to be able to use it in C.

Where's your language?

I don't suppose you could write up a tiny example?

Good on ya mate, we need more dreamers.
Don't let anyone stop you.

Bump, seriously though how does this work? If you have a VLA in a stack frame on which TCO is performed, how does it work, does the stack frame get resized somehow? Or is TCO just impossible in this case?

Why malloc in C is platform dependent and declared on stdlib.h, but in C++ new is part of the language?

Only God can stop me.

here's an user heavily interested in LISP, wants to do
>>>/lain/hum/6578

and wants to do it in

a) common lisp
b) clojure

Since I want to make an API, I'm thinking of doing the simple stuff in lisp,
and leaving the server/database parts to ruby.

So it's a win-win, simple on both sides.
My main issue is overall straight-forwardness.

I've seen that clojure projects are a mess, but syntax looks acceptable.
And I've no idea where to even begin with clisp.

But I also understand that I can (probably?) write a monolithic file and run it (leiningen aside).

So
>bottom line
I need to look at well-documented beginner-friendly examples of both clisp and clojure performing simple things.

Where do I go? Should I look up simple tools?
What are some simple tools that fit the above description?

Attached: G1v7z.jpg (500x500, 115K)

plz no bulli

Attached: 1519503773363.png (690x1049, 55K)

The best way is to make a shared header that will compile as both C and C++.

extern "C" specifies that a function can be called as if it were a C function. It disables name mangling but also uses C calling conventions if those differ from C++'s. This is meaningless in C, so you should use a macro that inserts the specifier if it's being compiled as C++ but leaves it out if it's C.

>foo.h
#ifndef FOO_H
#define FOO_H

// Define EXTERN_C to be extern "C" if compiling as C++, or nothing otherwise.
#ifdef __cplusplus
#define EXTERN_C extern "C"
#else
#define EXTERN_C
#endif


// forward declaration only
struct SomeClass;

typedef struct SomeClass *Wrapper;

EXTERN_C void fun1(Wrapper);
EXTERN_C void fun2(Wrapper);
EXTERN_C void fun2(Wrapper);
EXTERN_C int init(Wrapper*);
EXTERN_C void close(Wrapper);

#endif
Then you can write a C++ file which implements all those functions.
>foo.cpp
#include "foo.h"
// includes definition for SomeClass
#include "SomeClass.hpp"

EXTERN_C void fun1(Wrapper obj)
{
obj->fun1();
}

// and so on...

pdfs.semanticscholar.org/b57a/af581e043fb63c56ebd662720190e3121220.pdf
.NET core(release in june 2016) had to reimplement ALL features in .NET framework and make them ALL cross platform and now after two years it beats Java and .NET framework on benchmarks with the exception of IL emit (found on nuget but it doesn't run on all platforms) which causes regex to not compile.
Meanwhile Java added var.
.NET core has a bright future.

I can't right now. Have a look at
stackoverflow.com/questions/14917952
for now

TCO works with VLAs for the same reason that VLAs work in the first place.

>it beats Java
oblig
>.NET core is lacking so many features it's ridiculous, we've had to downgrade 2 projects recently because even MS Azure service APIs weren't supported - if you have to work with .NET avoid core and save your self the hassle - it's still alpha quality in many aspects after years since "1.0". I regret pursuing .NET career at this point, all recent developments on the platform are a joke - despite the praise they get for OSS moves. I'm moving towards frontend these days just to get away from this mess (ironic considering how messy frontend is - should tell you enough about state of .NET core/xamarin)

Because C++ has operator overloading.
C++'s "new" isn't platform dependent in and of itself, on the contrary it's a platform independent point of access to the platform dependent functionality of allocation. If you need it to use a different allocator, you can make it do so, because it can be overloaded.

cute!

Java doesn't even have properties

Good.

Absence of a """feature""" is not a deficiency.

Reminder that
>Java can't even cross-plaform console beep

Who's talking about Pajeetlang? There's much better JVMlangs widely used by the industry.

Absence of properties leads to proliferation of getters and setters.

Getters and setters are an antipattern. And you want to bake them into the language?

Thanks. Appreciate it. That gives me something to start with.

But if a function is declared as extern C, doesn't that cause problems with calling C++ code from inside it? Like overload methods or lambdas for instance.

Who needs CLIs in the 21st century anyway, gramps

Ahahhaha The Absolute State
You say so but you keep copy pasting that blog post by a butthurt pajeet claiming .net core lacks features. Dear pajeet, can you even enable http redirects on the http client your shitbeans offer without spaghetti code and NullPointerException (Java doesn't have pointers lol) everywhere?

>BOTH .NET and JAVA are bad

what did you mean by this?

Thanks.

Does anybody have a really good cube-voxel rendering tutorial series?
I've searched all over the web for example projects or tutorials and I don't get it still.

Particularly I don't understand how to represent rendering the voxel cubemap.
I don't know if I'm supposed to and cull with winding order, or constantly rebind the mesh every time I update it so cull it CPU-side.
I don't know if I should have cubes and then have preset of every single cull-type there is and pass it in as an enum/map of some type.
Or to just to represent them as planes and rotate/translate with matrices.

Most tutorials seem to skip this portion and just assume you're already a master of OpenGL and its knowledge.

>thinking he's talking to just one person
CLRjeets never fail to amuse

extern "C" only applies to the function's interface. You can use C++ features freely within the function.
The only thing you can't do is overload the function itself or place it in a namespace (kinda) because those apply to the function's interface, and C doesn't understand those.

Getters and setters are an essential part for every OOP PL.

Nice green arrows. I accept your defeat.

>Irrelevant statement. I win!
Embarrassing.

Ok, thanks. I'll try implement the example to see if I get it.

It fixes many issues with haskell plus provides many tools most have wished for / tacked on to haskell. Dependent haskell is around the corner but linear types are far away while idris has it now.

JVM is closely tied to Java.
Why do think every jvm lang has to be java-ish or hide java's makeup behind more makeup?
CLR is can be compatible with every language even Java can run on the CLR and ada already has a .net backed version (A#)

As if you are going to provide a meaningful statement after getting your fanboy ass so widely stretched.

Pass the coordinates of all cubes that are visible to the player and create a GL program that renders a single point as a cube

As soon as you add getters and setters, an object ceases to be an object. It becomes a glorified struct, a bundle of state, not leaking its implementation details so much as spilling them all. Getters and setters are anathema to OOP.

>start a new company
>produces and sell proprietary software
>steal code from related open-source projects

would this be legal? how could other people prove it if the software is proprietary?

So this is the "pajeet hours" on /dpt/.
At last I truly see.

CLR's past, present and future is handicapped by it being owned by MS.
Shame about wasting MSR's potential tho.

But what if I want to know the Dog's age?

Why do you need to steal it ?
Just sell OSS, which uses code from related OSS projects.
There's no difference, except for the legal part.

Projecting onto others your sphincter's propensity for being stretched by girthy objects won't help you win any debates.
Post pics tho.

Sure thing. That must be why Java and C++ classes are filled with getters and setters.
You might want to educate yourself on the subject and read about OOP encapsulation

I was just imagining what proprietary companies must be doing,

> i i i i i i i ooooo o ooooooo ooooo ooooo
> I I I I I I I 8 8 8 8 8 o 8 8
> I \ `+' / I 8 8 8 8 8 8
> \ `-+-' / 8 8 8 ooooo 8oooo
> `-__|__-' 8 8 8 8 8
> | 8 o 8 8 o 8 8
> ------+------ ooooo 8oooooo ooo8ooo ooooo 8

>Welcome to GNU CLISP 2.49 (2010-07-07)

I've just entered a world of pain haven't I?

C++ is a procedural abomination that has dealt immeasurable damage to the reputation of OOP. That every "OOP" language today follows its legacy is a travesty.

You have no idea

>CLISP 2.49 (2010
>2010
>2018-8
>8
>years
>ago
lisp is not a relic dot com

alright so now I should probably find a way to hook up a common-lisp program to a ruby program

path dependence
fucking humankind's progress since time immemorial

>hook up a common-lisp program to a ruby program
hwy

But culling

so I don't have to waste time on figuring out database drivers/implementations for it

w/ ruby and active record it's just Entry.do_something

Go for a modern implementation or use scheme which is much better

what's the use of lisp