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

  • SEARCH
  • Home
  • 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 221635
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T19:03:07+00:00 2026-05-11T19:03:07+00:00

I just read the information on this page , and while a new ?

  • 0

I just read the information on this page, and while a new ? operator is mentioned, it’s quite unclear to me what would its usage be.
Could anyone please provide a quick explanation, post a code snipped of how would this operator be used and possibly mention a use case?
Edit: this is really awkward, I’ve noticed that the ? operator is no longer mentioned in Don’s release notes. Any idea of why is that?

  • 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-05-11T19:03:07+00:00Added an answer on May 11, 2026 at 7:03 pm

    There are two new “special” operators in this F# release, (?) and (?<-). They are not defined, but they are available for overloading, so you can define them yourself. The special bit is how they treat their 2nd operand: they require it to be a valid F# identifier, but pass it to function implementing the operator as a string. In other words:

    a?b
    

    is desugared to:

    (?) a "b"
    

    and:

    a?b <- c
    

    is desugared to:

     (?<-) a "b" c
    

    A very simple definition of those operators could be:

    let inline (?) (obj: 'a) (propName: string) : 'b =
        let propInfo = typeof<'a>.GetProperty(propName)
        propInfo.GetValue(obj, null) :?> 'b
    
    let inline (?<-) (obj: 'a) (propName: string) (value: 'b) =
        let propInfo = typeof<'a>.GetProperty(propName)
        propInfo.SetValue(obj, value, null)
    

    Note that since the return type for the gettor is generic, you’ll have to specify it at use site in most cases, i.e.:

    let name = foo?Name : string
    

    though you can still chain-call (?) (since first argument of (?) is also generic):

    let len = foo?Name?Length : int
    

    Another, more interesting, implementation is to re-use CallByName method provided by VB:

    open Microsoft.VisualBasic    
    
    let inline (?) (obj: 'a) (propName: string) : 'b =
        Interaction.CallByName(obj, propName, CallType.Get, null) :?> 'b //'
    
    let inline (?<-) (obj: 'a) (propName: string) (value: 'b) =
        Interaction.CallByName(obj, propName, CallType.Set, [| (value :> obj) |])
        |> ignore
    

    The advantage of that is that it will handle both properties and fields correctly, work with IDispatch COM objects, etc.

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

Sidebar

Related Questions

I just read this post about why new-line warnings exist, but to be honest
Just finished read this post by Greg Young, where he is talking about Microsoft
I just re-read The Pragmatic Programmer (my third time reading it...I get something new
I read about Session Hijacking articles and would like to some more information related
So basically I would like my app to read info from a database, this
I just read up on a performance of LINQ, and there is a HUGE
I just read the Wikipedia article on mock objects , but I'm still not
I just read a post mentioning full text search in SQL. I was just
I just read Joel Spolsky's article, Up the tata without a tutu , where
Having just read the first four chapters of Refactoring: Improving the Design of Existing

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.