/dpt/ - Daily Programming Thread

What are you working on, Sup Forums?

Old thread:

Other urls found in this thread:

github.com/kmltml/oxidation/blob/master/examples/sdl/snake.ox
reddit.com/r/changelog/comments/6xfyfg/an_update_on_the_state_of_the_redditreddit_and/
rustbyexample.com/primitives/array.html
josephg.com/blog/electron-is-flash-for-the-desktop/
choosealicense.com/
tldrlegal.com/
twitter.com/SFWRedditGifs

rewriting linux kernel in C

Trying to use windows.h to create a gui.

kill me.

second for programming is hard

I used to write some small GUI utilities in Win32AP using MASM32 15 years ago, it wasn't that hard IIRC, just tedious.

Linux is already in C...

>calls himself a programmer
>has more facebook friends than github followers

>anime thread
thanks

The quality of that image fucking infuriates me every time.

>calls himself a programmer
>has facebook

I'm writing a file manager in racket.

I create all my GUIs that way
it's great, what seems to be the problem?

Hey, Sup Forums, tell me what you hate the most about my toy language:
github.com/kmltml/oxidation/blob/master/examples/sdl/snake.ox

Haskell!

If I wrote a book on combining functional programming with object oriented programming to get the best of both worlds, should I call it FOOP or POOF?

OFOP

>best of both worlds
impossible.
FP and OOP are incompatible. What you are imagining is just OOP, or what I've taken to calling it, OOP plus functions.

killyourselFOOP

>=>
What does it do?

>or what I've taken to calling it, OOP plus functions.
kek

>FP and OOP are incompatible
wrong.

>Hey, Sup Forums, tell me what you hate the most about my toy language:
how about you first say a few words about it
i am interested it looks really cool

It separates case pattern from body (like in scala and rust)

Recently I've really wanted to make an A.I. that would learn to play some simple games.
So just doing research on ai programming for now.

It's pretty much rust but without all that safety bullshit. It doesn't really have any innovative features, it just turned out, that making a compiler is fun as fuck and i have enough features i want to implement that i won't be bored for a year or so.

he's right, you know

what exactly do you compile to, what intermediate language do you use
i dont quite understand what's going on

I'm going to kill myself now thanks

I'm outputting asm files (real men don't use llvm). I habe my own intermediate representation language, which i generate from ast, do some passes on it and then convert to assembly. Then i just invoke nasm to assemble it and gcc to link an executable for me (i couldn't get microsoft's link or mingw's ld to work).

Use butterknife.

>I'm outputting asm files (real men don't use llvm)
nice
i did the same (code related), but mine is so much shittier and doesn't even have pointers, uses the stack too much and the assembly is slow, realistically speaking
admittedly i did it in two weeks, but still
how can i become as good as you
also, how long have you been progging
about 2 years for me

i want to maybe start over at one point and make it a usable language with pointers

do you do any sort of advanced register optimizations and 'planning' if you know what i mean or just do what's easiest to code? how does your lang compare to rust in terms of speed

really good job bro, it looks absolutely beautiful

@(function main () ()
(print_num (fibs_iter 10)))


@(function fibs (n) ()
(if (< n 2)
n
(+ (fibs (- n 1)) (fibs (- n 2)))))

@(function and (arg1 arg2) () (if arg1 (if arg2 1 0) 0))

@(function fibs_iter (n) (i a b tmp)
(= i 0)
(= a 0)
(= b 1)
(while (< i n)
(begin
(print_num a)
(= tmp a)
(= a b)
(= b (+ b tmp))
(= i (+ 1 i))))
a)


also i like the name, it's rust-like, so oxidation

Isn't suicidal encouragement illegal?

>and make it a usable language with pointers
So, Golang?

first for Java

Make it a microkernel.

How does Rust do arrays?

When building a c# dll, is there any way to make the compiler work harder at optimizing the output, in exchange for longer compile times?
Just curious.

no, oop is a data abstraction technique where the data is hidden behind a procedural interface. nothing prevent you to make that procedural interface functional. you guys know nothing about PLT.

object.just_mutate_my_state_up()
is not and will never be functional

>reddit is no longer open-source

reddit.com/r/changelog/comments/6xfyfg/an_update_on_the_state_of_the_redditreddit_and/

I stole a register allocation algorithm from some paper (it's called iterated register coalescing) but it's slow as fuck (most of the compilation time is taken by register allocator). I've been programming for quite a while now. Theoretically i started in primary school, though i obviously didn't make anything impressive then, so i guess i've been actually programming for about 7 years by now.
I didn't really try to benchmark it yet, and i don't do any optimisations yet so i bet it compares quite poorly to rust, but it shouldn't be terribly slow.

It took me all day, but I solved my issue with memory corruption causing seg faults.

It was because I passed a pointer to a local variable........

python's integer type is an example of functional objects.

>not [spoiler]new[/spoiler]ing on every mutator
dumb fpposter

This is a C question:
So I have a function pointer type defined as void (func)(void *x);

My function is void myfunc(int y);

Can I safely do func m = myfunc; m(5);
Or is it undefined?

You're doing it wrong. You want to take an address with &.

Probably, anyway.

undefined

Yes my bad.
myfunc(int* x)

rustbyexample.com/primitives/array.html

Basically they're contiguous blocks of memory, typically on the stack, just like in C. If you want to pass them around, you use what's called a slice, which is just a struct containing a pointer and a length field.

If you index a slice or array out of bounds, the program panics, but this is only during debug mode. When you build in release, there's no bounds checking.

No part of object oriented methodology prevents immutability of objects. C++ can even be explicit about it by letting methods be declared const, making it a compile time error for any part of that method to mutate the object it is called on.

hi /dpt/ - my visual studio got glitched, all of the sudden my My.settings stopped working (vb.net), it just underlines all "settings" and tells me pic related, what can I do to fix this?

They had to go closed source, so that they could hide their code designed to promote left-wing content and hide right-wing content.

Rust syntax seems a bit bloated and heavyweight but this is exactly how I'd expect a sane lang to do arrays, thanks.

im going to apply to some entry level database jobs in the coming weeks, but i cant figure out what kind of projects i can do with SQL for my portfolio? the job descriptions all list SQL, SSRS, MOSS

anyone have any recommendations?

im a CS grad that went the front-end route so my portfolio is full of javascript and php apps lol

Why do programmers bully webdevs? Is it because they make mad money?

why isn't Sup Forums opensource?

because they are bringing theirs bad practices to the desktop.
josephg.com/blog/electron-is-flash-for-the-desktop/

because webdev typically includes full-stack, front-end, and "designers"

front-end and designers arent real programmers. they're just professional copy and pasters. full-stack gets more programmy but they still rely too heavily on frameworks and libraries to do their work for them.

there are a shit ton of front-end people who use stuff like vue, react, node, etc. at work but dont actually have much experience programming in pure js. its absurd. if you can learn your profession in a matter of 5 hours from youtube videos, your job security is not good.

use SQL to make a rule system
basically you'll have your database entries, each one will have it's properties
then you'll make rules
like for example if you have a database of pornstars a rule could be

rule skinny
find height>175 and weight < 52

or something like that, i don't remember the SQL syntax right now
dont use pornstars though

im making a app for smart phones that allows people to procrastinate as efficiently as possible. you tap a button on screen that says procrastinate and it makes a sound like you did something but nothing happens

its going to revolutionize how people waste time at work and schools. i have angel funding already and it should be out sometime late next year. beta testing is proving to be time consuming

come on dude im 174

nice work, you app barista
I assume you are using react native for your thing?

Because webdevs were web designers a couple years ago, so they weren't considered programmers.
Now they call themselves programmers, they call FizzBuzz OMG MATH. It's them who spread rumours like programmers don't need to know math to be programmers.

Currently reading Design Patterns,

When they say Interfaces, they mean abstract classes right?

Employed Haskell programmer reporting back

interfaces are (sorta like) abstract classes without any implemented methods

What kind of a background are you coming from?

Rust, C++, and Ada are all rather verbose languages, but that verbosity usually has a purpose. When you write code in a systems programming language, it helps to be explicit about everything you do, so that it's harder to fuck everything up. You want to write fast code, but you also want to write code that does exactly what you intend with no derivations that could be caused by human error. It is always better to catch fuckups at compile time than at runtime in production when someone's life may be on the line.

Not familiar with Ada, but I fully understand your point. Weak typing is one of C's worst aspects IMO.

what do you do more specifically

Not a web developer (at least not exclusively) but I'm not that great at math either. Any recommendations for resources that might help me improve (specifically in regards to programming but I guess general stuff is okay too)?

ahh ok

Read Programming Principles and Practice using C++ around 2 years ago, spent the time in-between programming in Qt and Unreal

wanted to learn more about designing software architecture

Ada is anal-retentive, but trustworthy enough to run in airplanes and nuclear power plants.

So you're a C++ guy, makes sense.

Most OOP languages don't have multiple inheritance of classes. So they have the concept of an interface instead. An interface contains nothing but pure virtual functions. You can inherit from multiple interfaces. It's safer that way.

>m-muh print function
>m-muh interators
>fork the fucking language
>community is split

why are pythonistas so retarded?

You meant pytards?

I found this pearl in the Python standard library yesterday, apparently the zip library doesn't compress archives by default, it makes sense I suppose if you wanted to just archive files/folders in a zip but when do you not want to compress shit, apart from lossy objects.

Is tbere some chart of FOSS licenses?

>anyone have any recommendations?

Hell yes.

-Read "SQL antipatterns", it a really great book.

-Make a simple app and query the shit of of it.

-Learn about the pitfalls. SQL basic syntax is simple, but there are some nasty things (i.e. "NOT IT").

-Data structures. You should be able to set off a simple database with a few different values and their correct data type (date, number types, varchar, BLOB) without looking.

-Never forget that SQL is TENARY LOGIC. Learn how true/false/null are related to each other (logic table).

-Indexes (no, it's not called "indices"..). Many people don't bother with them, but it's so important to understand how and when to use an index.

-You should be able to explain the normal forms up until Boyce-Codd. Make up examples in your head. But also: learn some basics about denormalisation! When to use it? What are the advantages?

-Performance optimization is always good, but a big topic. If you how how to use properly use indexes you already know a lot. But if you are a real hotshot, get some basics about optimization.

-Backups/MetaData: Advanced topics. You are probably not supposed to know this, but you should know that these topics exist, if only to know what you NOT know.

-Stored procedures, triggers and PL/SQL: If they ask you about those.. run.

I-is this true, anons

>he doesn't know tail call optimisation
>he spreads literal facebook memes

Not if you use tail recursion optimization.

>15 years ago
Jesus user, I thought this board was for young people

Programming languages are so shitty that I'm currently evaluation the viability of non-java JVM languages as scripting languages, as well as other non-java JVM languages for desktop applications.
Fucking save me!

>writing code explicitly more complicated than it need to be in hope that the compiler might be able to optimize it
L O L

how old are you?

t. literal retard
kek

choosealicense.com/
tldrlegal.com/

22

thanks

Under certain circumstances recursion is a bad choice. But unless you are crazy shit in some special field like matrices or graphics, you'll be fine..


The greatest scripting language ever is Ruby.
The greatest JVM language is Clojure (you can also use SWING here, if you want some desktop things).

You're welcome.

Why Lisp is called sometimes to be non-true functional language?

Maybe you should take a look at non-C# .NET languages while you're at it. Actually don't. C# is okay; it's VB that sucks.

OOP seems like it'd be good to create different processes and communicate to each other. does it have facilities to do that easier than in C?

>It turns out modern operating systems already have nice, fast UI libraries. So use them you clod!
>Also all you web devs: Go learn C or Rust or something. Your program runs on a computer. Until you know how that computer works, you're doomed. And until then get off my lawn shakes fist.

I like this guy. And maybe we should be converting all of those JS programmers to Rust programmers. At least then we'll have faster programs (even if they use a bunch of crappy micro-libs)

What do you mean?

thanks user, i didnt expect such a detailed response.

the places im applying to are mostly healthcare related, and their requirements are exceptionally dry aside from just saying they'd like me to know about the stuff i listed (sql, ssrs, moss are all listed) and wanting someone with a degree.

Is there ANY reason why people would choose a license other than Unlicense?
This is free and unencumbered software released into the public domain.

Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.

In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
software to the public domain. We make this dedication for the benefit
of the public at large and to the detriment of our heirs and
successors. We intend this dedication to be an overt act of
relinquishment in perpetuity of all present and future rights to this
software under copyright law.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.

For more information, please refer to

Look at it. It's perfect.

Communicating with processes doesn't mandate you use a certain language. You just use some form of IPC or a socket.

if you have multiple processes running in memory that need to communicate to each other, in C the only way i could think of doing that would be to have it constantly loop and check if it's gotten any new messages. but languages like java emphasize communication between objects. what's the point of that communication if they're all in the same process?

For stuff I don't care about I prefer the CC0 because in some countries "public domain" doesn't exist. The CC0 license tries to address this and guarantee the recipients of your software as much freedom as possible while still complying with local copyright law.