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 7959743
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T04:37:14+00:00 2026-06-04T04:37:14+00:00

F# has both typed and untyped code quotations and I wonder what are the

  • 0

F# has both typed and untyped code quotations and I wonder what are the use cases where one would choose one over the other?

Is the distinction just convenience and untyped and typed quotations are convertible to each in all cases or are typed quotations e. g. a subset of the ones possible with untyped quotations?

Are there any examples which only work with typed, but not with untyped quotations – or the other way around?

  • 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-04T04:37:15+00:00Added an answer on June 4, 2026 at 4:37 am

    In general, I’d recommend using typed quotations whenever you can. As usual, the types will allow you to statically enforce some correctness conditions that might otherwise cause failures at runtime. Consider:

    let one = <@@ "one" @@>
    // exception at runtime
    let two = <@@ 1 + %%one @@>
    

    as opposed to

    let one = <@ "one" @>
    // compile time error: the type 'string' does not match the type 'int'
    let two = <@ 1 + %one @>
    

    Additionally, sometimes untyped quotations need additional type annotations in cases where typed quotations don’t:

    // ok
    let l = <@ [1] @>
    let l2 = <@ List.map id %l @>
    
    // fails at runtime (obj list assumed instead of int list)
    let l = <@@ [1] @@>
    let l2 = <@@ List.map id %%l @@>
    
    // ok
    let l = <@@ [1] @@>
    let l2 = <@@ List.map (id:int->int) %%l @@>
    

    However, if you’re building something extremely generic out of quotations, it may not be possible to use typed quotations (e.g. because the types aren’t statically known). In that sense, untyped quotations give you more flexibility.

    Also note that it’s extremely easy to convert between typed and untyped quotations as needed (upcast an Expr<_> to Expr to go from typed to untyped; use Expr.Cast to go the other way).

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

Sidebar

Related Questions

I know C# has both value and reference types, but how can you do
Pyramid has both Mako and Chameleon as install dependencies. My intention is to exclusively
If a page has both JQuery and Prototype then I got conflict. There is
I understand that AppFabric has both caching capabilities along with hosting WCF/WF services. I
The PyQt4 QTableWidget has both cellPressed and cellClicked signals. From the name, and the
I need to create a table that has both alternate and rounded TR corners,
I am making an app that has both a bottom bar and a top
I'm writing a program which has both an ASP.NET configuration system and a Silverlight
I have a Django webapp that has both a front-end, web-accessible component and an
I'm using a library which has both a C interface and a C++ interface

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.