Author Topic: What's your favorite language feature?  (Read 13345 times)

0 Members and 1 Guest are viewing this topic.

Offline mrflibbleTopic starter

  • Super Contributor
  • ***
  • Posts: 2051
  • Country: nl
What's your favorite language feature?
« on: March 05, 2020, 11:16:59 am »
Thought it would be fun to hear from other people what cool language features are out there. What feature in your programming language of choice do you like the most? Can be anything about any language.

My choice would have to be ... mmmhh, list comprehension in python. Maybe generators in general. Oh and itertools, and, and... But to keep it specific, yes, list comprehension.

So what's yours?
 

Offline jfiresto

  • Frequent Contributor
  • **
  • Posts: 809
  • Country: de
Re: What's your favorite language feature?
« Reply #1 on: March 05, 2020, 11:27:52 am »
Associative arrays (dictionaries), named arguments and coroutines
« Last Edit: March 05, 2020, 03:15:44 pm by jfiresto »
-John
 

Online tggzzz

  • Super Contributor
  • ***
  • Posts: 19470
  • Country: gb
  • Numbers, not adjectives
    • Having fun doing more, with less
Re: What's your favorite language feature?
« Reply #2 on: March 05, 2020, 11:37:09 am »
Hard realtime performance guaranteed by the IDE not measurement (combination of hardware and software), output to be executed at specified clock cycle, input received at a specified clock cycle. All found in xC running on xCORE processors

Built-in primitives (not libraries) for multiprocessor systems and inter-processor communication. Found in CSP, Occam, xC and to a lesser extent Rust and Go.
There are lies, damned lies, statistics - and ADC/DAC specs.
Glider pilot's aphorism: "there is no substitute for span". Retort: "There is a substitute: skill+imagination. But you can buy span".
Having fun doing more, with less
 

Online Mechatrommer

  • Super Contributor
  • ***
  • Posts: 11622
  • Country: my
  • reassessing directives...
Re: What's your favorite language feature?
« Reply #3 on: March 05, 2020, 11:51:12 am »
pointer, pointer to pointer, type casting, OOP, operator overloading. keen coder should already know what is this, only one language can provide this at humanly friendly language/syntax. the rest? list of <insert whatever here>, dictionary <insert your fav here> etc all can be made later on as a class or whatever (higher level function), but once the pointer feature is not available directly, it feels like sitting on a wheelchair losing both legs.
Nature: Evolution and the Illusion of Randomness (Stephen L. Talbott): Its now indisputable that... organisms “expertise” contextualizes its genome, and its nonsense to say that these powers are under the control of the genome being contextualized - Barbara McClintock
 

Online AndyC_772

  • Super Contributor
  • ***
  • Posts: 4227
  • Country: gb
  • Professional design engineer
    • Cawte Engineering | Reliable Electronics
Re: What's your favorite language feature?
« Reply #4 on: March 05, 2020, 01:27:27 pm »
Conditional execution, especially as applied to branch instructions.

Online SiliconWizard

  • Super Contributor
  • ***
  • Posts: 14447
  • Country: fr
Re: What's your favorite language feature?
« Reply #5 on: March 05, 2020, 05:27:26 pm »
Swearing and cursing.  ::)
 
The following users thanked this post: Siwastaja

Offline jfiresto

  • Frequent Contributor
  • **
  • Posts: 809
  • Country: de
Re: What's your favorite language feature?
« Reply #6 on: March 05, 2020, 05:40:32 pm »
Swearing and cursing.  ::)
Ah, but in what language?
-John
 

Offline boffin

  • Supporter
  • ****
  • Posts: 1027
  • Country: ca
Re: What's your favorite language feature?
« Reply #7 on: March 05, 2020, 05:56:40 pm »
  • Associative Arrays/Dictionaries (most modern languages)
  • Sets (Pascal).  Just wait until you use a set to represent an output register.  It's a thing of beauty....

 

Offline dferyance

  • Regular Contributor
  • *
  • Posts: 180
Re: What's your favorite language feature?
« Reply #8 on: March 05, 2020, 06:10:13 pm »
Separate compilation / linker.
So many "modern" programming languages don't bother with it (Java, .Net, Python, NodeJS). So you end up with Docker hell trying to manage all your dependencies.

A programming language ought to be able to produce a single executable without additional runtime libraries or installs. That isn't to say all applications should be a single executable, but they all ought to be able to use a linker to include dependencies (as well as exclude) at compile time.
 

Online SiliconWizard

  • Super Contributor
  • ***
  • Posts: 14447
  • Country: fr
Re: What's your favorite language feature?
« Reply #9 on: March 05, 2020, 06:37:47 pm »
Swearing and cursing.  ::)
Ah, but in what language?

Any that supports it. The OP said: "Can be anything about any language."

 

Offline ve7xen

  • Super Contributor
  • ***
  • Posts: 1192
  • Country: ca
    • VE7XEN Blog
Re: What's your favorite language feature?
« Reply #10 on: March 05, 2020, 08:01:04 pm »
I'm going to go with type inference as my favourite 'general' feature. It makes strongly typed languages so much nicer to use.

As for the 'coolest' feature, I'm going to go with Golang's goroutines and channels.
73 de VE7XEN
He/Him
 

Online tggzzz

  • Super Contributor
  • ***
  • Posts: 19470
  • Country: gb
  • Numbers, not adjectives
    • Having fun doing more, with less
Re: What's your favorite language feature?
« Reply #11 on: March 05, 2020, 08:51:11 pm »
I'm going to go with type inference as my favourite 'general' feature. It makes strongly typed languages so much nicer to use.

As for the 'coolest' feature, I'm going to go with Golang's goroutines and channels.

Actually Communication Sequential Processes' channels and execution semantics. From 1976, from CAR Hoare. Look him up on wackypedia etc.

First implementation : Occam in the early 80s. Current variant: xC,  as per my previous post :)
There are lies, damned lies, statistics - and ADC/DAC specs.
Glider pilot's aphorism: "there is no substitute for span". Retort: "There is a substitute: skill+imagination. But you can buy span".
Having fun doing more, with less
 

Offline Nominal Animal

  • Super Contributor
  • ***
  • Posts: 6242
  • Country: fi
    • My home page and email address
Re: What's your favorite language feature?
« Reply #12 on: March 05, 2020, 10:03:55 pm »
Aggressive and words of power.

External language bindings in various programming languages, and extended inline assembly in GNU C and C++.
 

Offline bsudbrink

  • Frequent Contributor
  • **
  • Posts: 406
  • Country: us
Re: What's your favorite language feature?
« Reply #13 on: March 05, 2020, 11:26:43 pm »
I like languages that allow direct access to hardware, including the CPU and its registers.  And the operations are represented by simple numeric codes in consecutive memory locations.
 

Offline David Hess

  • Super Contributor
  • ***
  • Posts: 16607
  • Country: us
  • DavidH
Re: What's your favorite language feature?
« Reply #14 on: March 06, 2020, 12:59:09 am »
Sane casting of integer multiplies and divides would be my favorite language feature if it existed.

 

Offline I wanted a rude username

  • Frequent Contributor
  • **
  • Posts: 627
  • Country: au
  • ... but this username is also acceptable.
Re: What's your favorite language feature?
« Reply #15 on: March 06, 2020, 03:17:42 am »
 
The following users thanked this post: NivagSwerdna

Offline golden_labels

  • Super Contributor
  • ***
  • Posts: 1208
  • Country: pl
Re: What's your favorite language feature?
« Reply #16 on: March 06, 2020, 04:02:01 am »
Prototype-based programming. Easy to abuse, but great for compatibility layers and modifying method behaviour. Unfortunately also quite inefficient. :(
Any type of sane multiline string literals, possibly coupled with indentation removal.
Template metaprogramming in C++. Too bad the error messages are unreadable.
Null coalescing and Elvis operators, in various shapes and forms.

Separate compilation / linker.
So many "modern" programming languages don't bother with it (Java, .Net, Python, NodeJS). So you end up with Docker hell trying to manage all your dependencies.

A programming language ought to be able to produce a single executable without additional runtime libraries or installs. That isn't to say all applications should be a single executable, but they all ought to be able to use a linker to include dependencies (as well as exclude) at compile time.
Java has a separate compiler (javac) and “linker” (java).

Since Java has no executables, it also means the second paragraph would not apply. However: the closest it has to executables, JARs, allow you to pack anything you want — including all the dependencies. This is a horribly bad practice that will bite you just like any other failure at using modularity, but there is nothing that prevents you from doing so.
« Last Edit: March 06, 2020, 04:08:20 am by golden_labels »
People imagine AI as T1000. What we got so far is glorified T9.
 

Offline ivaylo

  • Frequent Contributor
  • **
  • Posts: 661
  • Country: us
Re: What's your favorite language feature?
« Reply #17 on: March 06, 2020, 05:56:14 am »
functions as first class citizens
in any language...
 

Offline emece67

  • Frequent Contributor
  • **
  • !
  • Posts: 614
  • Country: 00
Re: What's your favorite language feature?
« Reply #18 on: March 06, 2020, 08:37:24 am »
.
« Last Edit: August 19, 2022, 03:46:05 pm by emece67 »
 

Offline jfiresto

  • Frequent Contributor
  • **
  • Posts: 809
  • Country: de
Re: What's your favorite language feature?
« Reply #19 on: March 06, 2020, 01:45:18 pm »
Closures
-John
 

Online SiliconWizard

  • Super Contributor
  • ***
  • Posts: 14447
  • Country: fr
Re: What's your favorite language feature?
« Reply #20 on: March 06, 2020, 04:02:02 pm »
Template metaprogramming in C++. Too bad the error messages are unreadable.

I would cite metaprogramming in general as well. Unfortunately, this is so badly implemented in most languages I know of that I can't really associate this sanely with any.
C++ templates were a nice attempt at first, but they became horrible, and yes the diagnostic messages are usually unusable, so you better get it right first or you will cry.

Since Java has no executables, it also means the second paragraph would not apply. However: the closest it has to executables, JARs, allow you to pack anything you want — including all the dependencies. This is a horribly bad practice that will bite you just like any other failure at using modularity, but there is nothing that prevents you from doing so.

Java itself is a horribly bad practice. >:D
 

Offline dferyance

  • Regular Contributor
  • *
  • Posts: 180
Re: What's your favorite language feature?
« Reply #21 on: March 06, 2020, 07:46:55 pm »
Quote from: golden_labels link=topic=232434.msg2950470#msg2950470
Java has a separate compiler (javac) and “linker” (java).

I intended to mean static or compile-time linker. Most languages and operating systems have some sort of dynamic linker.

Yeah, JAR is essentially a work-around, similar to Docker. It still is dynamic linking, slows down program startup, can fail for things that ought to be caught at compile time, doesn't eliminate dead-code or do link-time optimizations. But it is better than having a ton of files all over the place.
 

Offline TerminalJack505

  • Super Contributor
  • ***
  • Posts: 1310
  • Country: 00
Re: What's your favorite language feature?
« Reply #22 on: March 06, 2020, 09:03:32 pm »
I would say that, in general, my favorite language feature is "being modern."  That is, a language that evolves to meet the demands of modern software engineering and doesn't rest on its laurels and live in the past.  A language that helps the developer apply best practices as they are understood here-and-now.  (I'm basically calling-out languages like 'C', here.)

Specifically, I'd say one of the most interesting language features to come (back) around recently is coroutines.
 

Offline IDEngineer

  • Super Contributor
  • ***
  • Posts: 1926
  • Country: us
Re: What's your favorite language feature?
« Reply #23 on: March 23, 2020, 02:50:45 am »
Saw this thread and had to comment, since I just had to learn Python for a small side project....

You'll never realize how much you appreciate braces surrounding (read: clearly, unmistakably delimited) code blocks in C/C++, until you work in a language like Python where (invisible) (whitespace) indent levels attempt to substitute for them.

Whomever dreamt that up should be professionally embarrassed for eternity. No other accomplishment can possibly offset the lunacy of that decision.

EDIT: If we can take visible code block delimiters for granted, then my favorite language feature is pointers. Can't think of a single other feature that is as powerful and flexible. Can pointers be misused? Sure, just like any other powerful tool in any context. It's the wrong approach to cripple a language so you can better tolerate poor software authors. Hint: Poor software authors will always find ways to leave bugs in their code.
« Last Edit: March 23, 2020, 02:59:53 am by IDEngineer »
 
The following users thanked this post: AlfBaz, BillyD, bsudbrink

Online SiliconWizard

  • Super Contributor
  • ***
  • Posts: 14447
  • Country: fr
Re: What's your favorite language feature?
« Reply #24 on: March 23, 2020, 02:45:04 pm »
You'll never realize how much you appreciate braces surrounding (read: clearly, unmistakably delimited) code blocks in C/C++, until you work in a language like Python where (invisible) (whitespace) indent levels attempt to substitute for them.

Whomever dreamt that up should be professionally embarrassed for eternity. No other accomplishment can possibly offset the lunacy of that decision.

Ahah, I fully agree. This is wrong on so many levels, but one that's definitely worse than others is maintainability and code sharing.

More generally speaking, this is a pet peeve of mine actually: many people seem to be in the quest for minimizing the number of characters they have to type when writing code, and blame overly "verbose" languages. C is already pretty lean, but some people find it still too verbose and want to get rid of more signs like braces and parentheses.

I think this is completely dumb, and often say that if the number of characters you have to type to write a given piece of code really matters to you compared to all other design and implementation tasks, then the code you write must be either really simple or really lame.

Just my 2 cents. ::)
 
The following users thanked this post: cliffyk, BillyD, dbctronic


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf