/dpt/ - Daily Programming Thread

Old thread: What are you working on, Sup Forums?

Other urls found in this thread:

chapel.cray.com/
github.com/Jazqa/kwin-quarter-tiling
github.com/rust-lang/rust/issues/41646
locka99.gitbooks.io/a-guide-to-porting-c-to-rust/content/fixing_problems_in_c_cpp/templates.html
rustbyexample.com/cast/inference.html
doc.rust-lang.org/1.11.0/book/generics.html
twitter.com/SFWRedditGifs

yeah, chapel really is the best language.

I just ordered some new programming socks off amazon!

first for bits are just an abstraction on top of bytes and registers

Whys that?
I like to procrastinate with new toylangs.

cat face says it all

or New language designed for high performance computers and cluster.

Post cute soles while you have a dildo up your cute little trap ass :3

Tiling script for KWin. It's one of the first things I've ever written or done programming-wise (first Javascript) and it's getting out of hand.

chapel.cray.com/

I'd like to hear your personal account why though.

>toylangs
I've read this as toryfags.

Learn some Rust you fags

fn add2(x: i32, y: i32) -> i32 {
// Implicit return (no semicolon)
x + y
}

>// Implicit return (no semicolon)
Why would I want to learn this shitlang?

source?

The code is very messy, partly because of the stupid scripting api making things overly complicated. I also have no fucking idea how people use their desktops and I've always adjusted it to my own use.

github.com/Jazqa/kwin-quarter-tiling

>all that verbosity
auto add(int a,int b) pure
{
return a + b;
}

>pure
what is this?

fn add2(x: i32, y: i32) -> i32 {
// Implicit return (no semicolon)
x + y
}

fn main() {
println!("the result is: {}", add2(13, 15),); // prints the result is: 28
}


Now you saw a complete Rust program and know that the compiler is rustc

It's too late to go back now.

assurance that said function is pure.

>explicit typing
ew

Seems cancerous, why would you need to write pure?
Also why the int?

(define (add x y) (+ x y)) Here you go.

I guessed, but what language? I don't believe sepples has that

auto add(T)(T a, T b) pure
{
return a + b;
}

D

*pukes*

Absolutely disgusting, templates are cancer.

It has really simple C interface and if you use clang backend you can basically just import C header and be done with it. This is really the biggest reason why I stopped looking at Ocaml and tried Chapel instead.
It has type inference and the syntax looks clean.
// statically typed, beatiful and clean
proc fn(type t, x) {
var tmp:t; // declaring variable with type t, don't really need it if the compiler can ques it
tmp = get_type_t(x);
}

// ugly java shit
void fn(Object x) {
T tmp = get_type_t(x);
}

It's desinged for parallelism and at least the build in operations seems really easy to use.
// might run parallel, actually it depends on how many task are currently running
begin {
fn();
fn2();
}
sync(); // wait for fn and fn2 to finish.

I have no idea how the locales and other stuff work in it but the language supports running stuff in GPU if you want to. So I ques the parallelism stuff looks good for the future, also it's not tied to any big company or platform like Apples swift which seems to have at least similar syntax.

t. only bases his opinion on Sepples templates

Nope, I clearly based my opinion on the D template that was shown to me just a few posts before.

please show us your one true template

Looks disgusting.
Please stop shilling your shitty language that ignores thousands of years of CS research please.

Youll call anything thats not lisp, heresy.
?, D just makes things simpler desu, nothing special.

>Youll call anything thats not lisp, heresy.
No, I will call anything that's a shitty language, heresy.

quality /dpt/ thread, guys

Not crazy on the syntax, but seems like a modern pascal flavor.

templates are ass
use real polymorphism

these are ways to initialize immutables (constants) in Rust
let x: i32 = 1;
let y: i32 = 13i32;
let f: f64 = 1.3f64;

if you want mutables you should use let mut
let mut m = 11;

arrays and ranges:


let array = [1, 2, 3];
for i in array.iter() {
println!("{}", i);
}


for i in 0u32..10 {
print!("{} ", i);
}

now use Rust you fags, you know you want to

Holy shit, this is pure cancer.

C A N C E R

conditionals don't need parenthesis in Rust

if a == b {
println!("equal");
} else {
println!("not equal");
}

while 1==1 {
//do shit
}

pls make it stop

Why is it bad?

It causes permanent brain damage.

{} are forced in rust
println is a thing (instead of a print where you just add a \n)
println! meme
Not using their shitty style causes warnings github.com/rust-lang/rust/issues/41646

61452214
>i just want to shitpost and actually have no argument
got in

Look at this wicked fizzbuzz.

main(i){for(;i

C's type system is pathetically weak. Types in C are simply an afterthought, and this is painfully obvious in declarations. OOP is all about defining your own types and the operations which are valid over them. Pasting a system that demands strong typing into a language that tried its hardest to sweep types under the rug is a mistake.
So the first casualty of C++ is the declaration syntax, which is conceptually fucked. C declarations follow usage, C++ declarations follow typing. The majority of C++ programmers try their best to ignore that and write utter garbage like this just to achieve some perceived consistency.
int* ptr;
There are three or four different ways to initialize your objects and half of them break if you look at them funny. They overlap and contradict in usage and behavior, and fight against the old C usage-oriented declaration syntax.
vector a(10);
vector b{10};
vector c(10, 20);
vector d{10, 20};
vector e = {10, 20};
vector f;
vector g();
vector h{};
Sepples trips at the first hurdle, you could pick any aspect apart with this much autistic scrutiny and it wouldn't be difficult. Templates and STL are another easy target, the syntax for templates is arcane and has bizarre restrictions while the STL is full of unchangeable past mistakes like non-RAII streams, ::type and ::value bullshit, even crap that's retarded but only awkward like vector.

I hate sepples, but I don't know what's better.

>not generic
fuck off faggot
fn add2(a: T, b: T) -> T {
a + b
}

Rust is an embarrassing language.

>templates
>generic

>not generic

it's a gentile introduction but thanks

please keep showing people how to declare generic classes and so on

I don't really care about what you think. It's fast, the only bugs I get are logic bugs and it's maintainable. I'm not forced to use Rust, I'll use other languages when they give me an advantage.

Hello fellow anons.
I want to make a website that have for example 3 squares per row, goes to a instagram account and posts the pictures and videos in each square by date. I have no problem doing this manually but obviously that's not very handy. I'm thinking about getting the instagram html code with python and put the pictures/videos url in a list. Then write that list to a txt and open that with javascript. Is there a better way to do this?

Rust doesn't have templates, not sure what you're trying to say.

>when they give me an advantage.
How about not having to type twice as much to achieve something.

Seems like you've never maintained a big software project or written performance critical code yet.

are they instantiated only at compile time

Literally any simple thing in Rust has extra steps, how would that not scale up as your code grows?

Yes, most of the time these functions get expanded to their native form for every type that calls it. If you use trait objects you'll get a dynamic function with jump tables though,

You call that shit "generic"? You have a lot to learn, kid.
fn add3(a: T, b: U) -> ::Output {
a + b
}

>no higher ranked types
>no hkts

Is this a joke? Are we being trolled?

>the only bugs I get are logic bugs
Literally in every language except dependant typing ones?

The rust type system is turing-complete which also happens to mean that it's shit.

Rust TMP when?

Hah, not sure how that stuff works. Thanks though, I'm not an expert at Rust yet. How does the `T as std::ops::Add` work?

thanks for making C++ look compelling

use haskell instead

add = (+)

>go
>hurr durr no generics

>rust
>hurr durr generics are hard

What? Are you retarded?
Nobody posted anything about Go in this thread and the complains about Rust are not about "generics" being hard, they are about templates being shit, it's lack of proper parametric polymorphism and type inference.

why is it so restrictive btw?
> error[E0277]: the trait bound `i64: std::ops::Add` is not satisfied

You are all such babies. I'm just getting started.
fn add4 (a: T, b: U) -> ::Output {
(a.into() + b.into()).into()
}

fn main() {
println!("{}", add4::(1, 2));
}

I was talking about the general consensus of Go in Sup Forums. Rust's generics aren't templates. Rust's generics check whether the passed type implements the required traits that you specify in the function header, it isn't just dumb function expanding. Here's a good article on the differences: locka99.gitbooks.io/a-guide-to-porting-c-to-rust/content/fixing_problems_in_c_cpp/templates.html
And what's wrong with Rust's type inference? And what is wrong with Rust's parametric polymorphism?

A CPU can't add an i32 and an i64. If you really want to add an i32 and an i64, you could use type casting.
let a: i32 = 3;
let b: i64 = 5
let c = add(a as i64, b);

Honestly, the lack of implicit integer conversions is just a fucking pain in the ass.

>And what's wrong with Rust's type inference? And what is wrong with Rust's parametric polymorphism?
They literally do not exist, this is what is wrong.

>type inference doesn't exist
rustbyexample.com/cast/inference.html

>parametric polymorphism doesn't exist
doc.rust-lang.org/1.11.0/book/generics.html

>A CPU can't add an i32 and an i64
A language that cares so much about a specific CPU architecture can't be called sane nor high level.
Same goes for i32/i64 types instead of being able to have a iN type where N can be any number or ranges like ada.

>rustbyexample.com/cast/inference.html
Great, now try it on a function argument.

The fact that it is possible to do it for variables also shows how rust does not have any mathematical background, after all "let" is implemented over a lambda in lambda calculi.

>doc.rust-lang.org/1.11.0/book/generics.html
Just proves my point.

I just thought since the return type is i64 why the fuck can't it do a non-narrowing conversion?

Can you please fuck off.

>rust
>i64 = i32 + i32: hurrrr error!! (can't overflow)
>i64 = i64 + i32: not error ;) (can overflow)
Why is rust so shit?

Get out of here rust shill.

>someone talked badly of my shitty language, oh no ;_;

Show benis

muh language that achieves safety by being so bad nobody would use it so there can't be any harmful software written in it.

it's not a overflow issue, they're just stupid and didn't integrate the concept of non-narrowing into the language

oops, meant
>i64 = i64 + i64
Instead of
>i64 = i64 + i32

I'm not a Rust user, I just think that you're a retarded faggot who probably uses some ultra hipster FP language.
Fuck off. We only do real programming here.

Reminds me of this

>rust
>real programming
??

I-I like C and Ruby... Why does nobody talk about god ol' reliable C and /comfy/ Ruby?

As I said, I'm not a Rust user.

The point is that it throws an error on a safe expression while it does not care at all on an expression that could cause overflow issues. This is just a side effect of what you said indeed.

>Why does nobody talk about god ol' reliable C
Lots of people talk about C.

it's 2017 and programming must be made difficult if we want to keep the money flowing our way

>reliable C

H-Hi
H-how is the client going? I haven't worked on it the last days ;-;

C is trash.
It has no type safety and no modern features for productive and safe programming.

>C
>Reliable
Don't make me fucking laugh.
Just look at all those CVE's.

t. Former C programmer.

...

Sadly this is true for most modern languages.

I don't understand. I thought all the Rust zealots disappeared once they became the laughing stock of the internet with
>When are you going to rewrite it in Rust?
Why did they come back from under the rock they have been hiding?

No, it's only C.

>from importlib import import_module as _import

Not true.

I-Is that Mikoto-chan?...
(゚д゚;)