4 Replies - 803 Views - Last Post: 01 March 2010 - 06:21 AM

#1 Core  Icon User is offline

  • using System.Linq;
  • member icon

Reputation: 774
  • View blog
  • Posts: 5,097
  • Joined: 08-December 08

Less popular language features

Posted 27 February 2010 - 02:26 AM

As with every tool, once you get to use a programming language for a while, you discover some features that are not widely used by other developers but at the same time appear extremely useful. For me this was the possiblity to use ternary operators in C#, and those saved me a lot of code space in several projects. In fact, it is not an undocumented feature, but it is not widely used by other developers.

What are some programming language features you found useful that are not actively used by other developers? Any undocumented features?

Is This A Good Question/Topic? 1
  • +

Replies To: Less popular language features

#2 Raynes  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 611
  • View blog
  • Posts: 2,815
  • Joined: 05-January 09

Re: Less popular language features

Posted 27 February 2010 - 08:47 AM

Heh. I honestly can't think of anything. If you were asking for the exact opposite, I would probably have a few. I was going to say lexical variables in Factor, but I suppose they are used more than I think they are.

On the other hand, I tend to use them in place of any stack shuffling that takes me more than 7 minutes to think about. A lot of Factor users are a bit more clever than me, I suppose. ;)

This post has been edited by Raynes: 27 February 2010 - 08:51 AM

Was This Post Helpful? 2
  • +
  • -

#3 baavgai  Icon User is offline

  • Dreaming Coder
  • member icon

Reputation: 5780
  • View blog
  • Posts: 12,596
  • Joined: 16-October 07

Re: Less popular language features

Posted 27 February 2010 - 09:18 AM

In C#, delegates. They're used extensively in the core libs, they're the heart of the event system, but regular .NET programmers will write a loop or a method before doing a one line anonymous delegate.

Along the same lines, other languages support things like function pointers or first order functions. People might use a callback function when forced to, but rarely write their own.

In C++, const. This sounds strange, since const means about five thousand things in C++. While const can be seriously overdone, I really like knowing that a particular method isn't going to impact my object's data.

In C, it's a common misconception that variables must be declared at the top of the function, rather than the top of the block. Smaller scoped variables make me happy.

In most languages; generics. If your collection uses objects rather than the actual specific type you're working with, it's missing a key constraint.
Was This Post Helpful? 2
  • +
  • -

#4 MentalFloss  Icon User is offline

  • "ADDICTED"[2:5]
  • member icon

Reputation: 526
  • View blog
  • Posts: 1,397
  • Joined: 02-September 09

Re: Less popular language features

Posted 28 February 2010 - 09:24 PM

Quote

What are some programming language features you found useful that are not actively used by other developers? Any undocumented features?


In regards to C#:
KeyedCollection<K,V> (I dig this thing despite its impediments. http://msdn.microsof.../ms132438.aspx)
Was This Post Helpful? 2
  • +
  • -

#5 dorknexus  Icon User is offline

  • or something bad...real bad.
  • member icon

Reputation: 1255
  • View blog
  • Posts: 4,618
  • Joined: 02-May 04

Re: Less popular language features

Posted 01 March 2010 - 06:21 AM

I try to avoid using the ternary operator in C and C++ for readability reasons. Also one of the organizations I worked for would cut off your fingers for introducing ternary operators into any controlled source.
Was This Post Helpful? 1
  • +
  • -

Page 1 of 1