Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8098853
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T22:12:26+00:00 2026-06-05T22:12:26+00:00

Being spotted in context of this question this seemingly inconsistent behavior can be reproduced

  • 0

Being spotted in context of this question this seemingly
inconsistent behavior can be reproduced as following both in F#2.0 and F#3.0 RC:

type Heterogeneous =
    static member Echo([<ParamArray>] args: Object[]) = args

type Generic =  
    static member Echo<'T>([<ParamArray>] args: 'T[]) = args

Usage:                                                              Returns:

Heterogeneous.Echo 0              // [|0|]                OK
Generic.Echo 0                    // [|0|]                OK
Heterogeneous.Echo (0,1)          // [|0; 1|]             OK
Generic.Echo (0,1)                // [|0; 1|]             OK
Heterogeneous.Echo [|0|]          // [|[|0|]|]            OK?
Generic.Echo [|0|]                // [|0|]                OOPS!!
Heterogeneous.Echo ([|0|],[|1|])) // [|[|0|]; [|1|]|]     OK
Generic.Echo ([|0|],[|1|]))       // [|[|0|]; [|1|]|]     OK

Can anyone explain if the observed behavior is a bug, or feature?

UPDATE:
This related answer communicates a confirmation from F# development team that as of now a bug has place in processing of generic type arguments with ParamArray attribute.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T22:12:27+00:00Added an answer on June 5, 2026 at 10:12 pm

    The case is slightly confusing because when you use an array as an actual argument to a parameter marked with ParamArray, the language tries to interpret it as if you were passing array to a normal array-typed parameter (so it ignores the ParamArray attribute if possible).

    In your example, this is possible in the second case:

    Generic.Echo [|0|]
    

    The compiler infers that 'T is int and so you’re passing int[] to a parameter of type int[] and so the compiler ignores ParamArray attribute and the method simply gets an array containing 0.

    In the other case, this is not possible:

    Heterogeneous.Echo [|0|]
    

    The method expects a parameter of type obj[] and the type of the argument is int[], so the two types cannot be unified (the key is that the compiler does not automatically convert int[] to obj[]). Since this is not possible, it considers the ParamArray attribute and tries to convert int[] to obj and pass it as a member of ParamArray – this is a conversion that the compiler can automatically perform and so you get the result you described.

    If you called Heterogeneous.Echo with obj[] as an argument, then it would behave similarly to Generic.Echo. For example:

    Heterogeneous.Echo [| box 0 |]
    

    If you want to go into details, you can look at section 14.4. of the F# language specification. However, the overload resolution rules are pretty complex and so I don’t have an exact reference that explains this behaviour – just an informal explanation above.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Being rather new to ASP.MVC I'm looking for a solution to the following routing
being new to WPF this is a complex problem for me. What i want
Being new to both WPF and MVVM, I'm studying Josh Smith's article on the
Being a bit perplexed about this issue by now, I hope some of you
I've just spotted the following in the C99 ISO standard, 7.19.6.1 The fprintf function
EDIT following resolution, this has been substantially edited to dump irrelevant detail and explain
Being a noob ... I can't quite figure out what isn't working here ....
Being new to tablet programming this occured to me. I could see that there
Being relatively new to the software industry I have come across a question of
I'm new to Ruby, so apologies if this sounds really silly. I can't seem

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.