Click here to Skip to main content
15,898,588 members

Survey Results

What features are most important to you in a programming language?   [Edit]

Survey period: 17 Dec 2007 to 24 Dec 2007

If one language did everything there would only be one language... (suggested by Milan1612)

OptionVotes% 
Automatic memory management93649.81
Industry acceptance as a "standard" language80142.63
Support for Object Oriented Programming1,50279.94
Templates or Generics77141.03
Strong Typing94450.24
Inbuilt support for regular expressions46824.91
Support for reflection55129.32
Cross-platform support76440.66
Support for default parameter values in functions43222.99
Namespace support68036.19
Support for First-class functions25313.46
An extensive standard library1,22565.19
Multiple return values from functions32917.51
Compile to native code (instead of byte code or intermediate code)64034.06
Respondents were allowed to choose more than one answer; totals may not add up to 100%



 
GeneralRe: Multiple return values from functions? [modified] Pin
Marshall Rosenstein19-Dec-07 3:27
Marshall Rosenstein19-Dec-07 3:27 
GeneralRe: Multiple return values from functions? Pin
W Balboos, GHB19-Dec-07 7:04
W Balboos, GHB19-Dec-07 7:04 
GeneralRe: Multiple return values from functions? Pin
Marshall Rosenstein19-Dec-07 7:51
Marshall Rosenstein19-Dec-07 7:51 
GeneralRe: Multiple return values from functions? Pin
W Balboos, GHB19-Dec-07 8:07
W Balboos, GHB19-Dec-07 8:07 
GeneralRe: Multiple return values from functions? Pin
Marshall Rosenstein19-Dec-07 8:17
Marshall Rosenstein19-Dec-07 8:17 
GeneralRe: Multiple return values from functions? Pin
PIEBALDconsult20-Dec-07 17:24
mvePIEBALDconsult20-Dec-07 17:24 
GeneralRe: Multiple return values from functions? Pin
Anton Afanasyev19-Dec-07 11:28
Anton Afanasyev19-Dec-07 11:28 
AnswerRe: Multiple return values from functions? [modified] Pin
Marshall Rosenstein20-Dec-07 6:09
Marshall Rosenstein20-Dec-07 6:09 
Hi,

I haven't heard of the Connect website -- is it something I should explore?

I don't think they'll ever add var as a return function value, and here's why.

The Type of var is known at compile time since it is the compiler that auto-generates the Type. However, the accessibility of the Type is always internal sealed. Also, if you look at the IL for foo(), there is no boxing that occurs, since anonymous types are not value types.

Since public var foo() is public, it would require that the return Type of foo() to be public as well. This is especially important when the method you are calling is in an external library. Otherwise you introduce the following problems:


  1. The var or object can't be cast to its original type by the caller.
  2. You can only access the data in the var using reflection.
  3. Since the return Type of foo() isn't named in the meta-data (this can be verified using reflection), the Intellisense parser would have to both parse and interpret the IL of the third party library function to determine the actual return Type. In some cases, it is not possible to determine the return Type at compile time. For example, if the function logic contained a switch statement where what is returned is conditioned in some way by the runtime values of the input parameters:
    //Return Type cannot be determined at compile time
    public var foo()( int myRuntimeVal )
    {
       switch( myRuntimeVal ){
          case 1: return new{ Value=1 }; //Anonymous Type 1
          default: return new{ Name="Hello", Value="World" }; //Anonymous Type 2
       }
    }
  4. Once the IL analysis successfully determined the Type, it would have to use reflection to determine the available properties of the Type.

Changing the auto-generated type from internal to public is in essence the same as proposing that anonymous types no longer be anonymous. Even so, on another post, I proposed a couple ways this might be done. "Named auto-generated types" is of course possible. This is adding language support to create a public contract based on ad-hoc definitions of data-structures. In practice, these definitions are subject to change due to the context in which such definitions are intended to be used - data queries. This becomes a real maintenance problem in terms of "published" interfaces, especially for third-party users.

One easy solution would be to only allow the var keyword to be used for private or internal functions.
---------------------
Marshall Rosenstein
.NET Consultant

modified on Thursday, December 20, 2007 12:23:31 PM

GeneralRe: Multiple return values from functions? Pin
Anton Afanasyev20-Dec-07 17:07
Anton Afanasyev20-Dec-07 17:07 
GeneralRe: Multiple return values from functions? Pin
PIEBALDconsult18-Dec-07 10:04
mvePIEBALDconsult18-Dec-07 10:04 
JokeRe: Multiple return values from functions? Pin
Xiangyang Liu 刘向阳18-Dec-07 11:00
Xiangyang Liu 刘向阳18-Dec-07 11:00 
GeneralRe: Multiple return values from functions? Pin
leppie18-Dec-07 21:10
leppie18-Dec-07 21:10 
GeneralRe: Multiple return values from functions? Pin
DQNOK19-Dec-07 5:48
professionalDQNOK19-Dec-07 5:48 
GeneralRe: Multiple return values from functions? Pin
PIEBALDconsult20-Dec-07 18:01
mvePIEBALDconsult20-Dec-07 18:01 
GeneralA good IDE Pin
Nibu babu thomas17-Dec-07 21:17
Nibu babu thomas17-Dec-07 21:17 
GeneralRe: A good IDE Pin
Vasudevan Deepak Kumar17-Dec-07 23:01
Vasudevan Deepak Kumar17-Dec-07 23:01 
GeneralRe: A good IDE Pin
Nibu babu thomas17-Dec-07 23:12
Nibu babu thomas17-Dec-07 23:12 
GeneralAdvanced dev Pin
Paul Watson18-Dec-07 22:38
sitebuilderPaul Watson18-Dec-07 22:38 
GeneralRe: Advanced dev Pin
Nibu babu thomas19-Dec-07 0:12
Nibu babu thomas19-Dec-07 0:12 
GeneralRe: Advanced dev Pin
Paul Watson19-Dec-07 0:22
sitebuilderPaul Watson19-Dec-07 0:22 
GeneralRe: Advanced dev Pin
Nibu babu thomas19-Dec-07 0:40
Nibu babu thomas19-Dec-07 0:40 
GeneralRe: Advanced dev Pin
Paul Watson19-Dec-07 0:50
sitebuilderPaul Watson19-Dec-07 0:50 
GeneralRe: A good IDE Pin
Paul Watson18-Dec-07 22:36
sitebuilderPaul Watson18-Dec-07 22:36 
GeneralRe: A good IDE Pin
Vasudevan Deepak Kumar19-Dec-07 2:43
Vasudevan Deepak Kumar19-Dec-07 2:43 
GeneralSo many missing aspects Pin
leppie17-Dec-07 20:32
leppie17-Dec-07 20:32 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.