ITT: Your favourite language features

ITT: Your favourite language features.

Mine are templates and operator overloading.

Other urls found in this thread:

whiley.org/2016/11/15/mixfix-function-syntax-for-whiley/
lmddgtfy.net/?q=Forth
bitbucket.org/iopq/fizzbuzz-in-rust/src/d4638b2ba3f09efe053ee0c4251036607847987c/src/lib.rs?at=master&fileviewer=file-view-default#lib.rs-58
twitter.com/AnonBabble

bump

typeclasses
mixfix function calls
compile time evaluation

>templates
>lambda functions

>Your favourite language features.
Matrix selection in Matlab, that is just awesome.

Decorators (Python), tail call optimization (many), closures (many), operator overload (D)

Can't you have decorators in D?

Dependent types

reflection

Interesting thread idea OP... I likely
TYPES

Fucked up , meant to say "operator overload (many), design by contract (D)"
I've never actually used D but like the contract idea

Holy shit just looked up mixfix function calls and that shit is WILD

How is add(x)to(list) better than add(x, to=list)? Or even just list.add(x)? Genuine question

What's an elegant way of declaring functions and variables that a language allows?

affine types, keyword args, structural types

whiley.org/2016/11/15/mixfix-function-syntax-for-whiley/

Languages that are doing the logical thing and model operators as functions with dot-free notation, as is proper and logical.

Languages that model operators as a special thing should be trashbinned.

I saw that already, it's not compelling me at all

closures

then you're fucking cancer

Rust's traits are elegant and together with its generics form extremely cheap abstractions. Things like closures and operator overloading are all implemented in terms of traits, which lowers the mental overhead dramatically. C++'s OOP model doesn't compare.
I like how Rust generics are trait-bound, but ultimately I think I prefer C++ generics for how much more is possible with them.
CTFE is really nice too. I find it quite useful for creating lookup tables in low level C++ code using constexpr.
The rest of Rust's type system is pretty nice too. Tuples and enums are a large reason why. Matching over enums is comfy and they make error handling explicit and terse.
That said I find Rust generally a massive pain to write in due to the borrowchecker.

I'm not all that familiar with high level functional abstractions like the ones you might find in languages like Haskell, but I definitely have an appreciation for the cheap abstractions these languages offer.

Not that guy but it makes sense if you don't remember the full definition (mainly argument order). However it's useless for a functions that operate on a given data and take 2 additional arguments that can both be only described with same name. Eg. opname(x)using(arg1, arg2) unless it's something like a math operation where order is easy to deduce or arg1&2 are interchangeable you have to know function's signature anyway.

static type system
compile-time perfect hash table
move semantics
stack allocation
proper modules and no header files
utf-8 strings
pattern matching on function calls
I don't have a favorite language

The real redpill is to be greatfull for the borrowchecker.

>pattern matching on function calls
dude SFINAE lmao

Forth's
: what-do-you-want what-do-you-want ;

that's a problem of templates
things work well in Haskell and Erlang

Lambdas and object spread operator

this

also for Sync, Send and Clone/Copy traits

generic protocols
first class functions
structs

Didn't get it

goto, inline asm

It wasn't a joke, search Forth lmddgtfy.net/?q=Forth

Sum types
Pattern matching conditionals
Arbitrarily nested heterogenous hash maps and lists
Piping, chaining, or UFCS
Smart pointers
Modules
Package manager in build system
String type that's just an array of chars, and no other goddamn string types in the lang

the borrow checker is not the problem

the lifetime system is very complex, I ran into some issue with higher ranked lifetime bounds that I couldn't resolve

I ended up giving up on calling deref and then my function and made my function ALWAYS deref inside it because it wasn't possible to make it work otherwise

I couldn't understand the explanation for WHY it didn't work either

bitbucket.org/iopq/fizzbuzz-in-rust/src/d4638b2ba3f09efe053ee0c4251036607847987c/src/lib.rs?at=master&fileviewer=file-view-default#lib.rs-58

I couldn't split the call to this function into `.cloned()` and then `apply` I have to deref inside for a reason I don't understand

Hindley-Milner type system.

Null coalescing operator
Lambdas
First class functions.

PG-chan agrees

It's not that different from named parameters, but more prettier, more powerful and more general.

You can write some DSL in it, and implement for example a ternary if it it like if_then_else_but . Other Three-Argument operators might get prettier. Like From_To_Integrate_ .