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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T18:21:47+00:00 2026-05-23T18:21:47+00:00

I think newbies are going to be confused by ‘do’ and I wonder about

  • 0

I think newbies are going to be confused by ‘do’ and I wonder about it from a language design standpoint. You don’t want to confuse newbies at this stage of the life of a new language where pretty much everyone is a newbie and you want newbies in order to build a community and critical mass 😉

The documentation for ‘do’ (3.8.3. To do or not to do) says:

There is a very good reason for this construction: in Opa, every function definition (and more generally every value not at toplevel) ends with one value, which is the result of the function — conversely, once we have reached the first value, we have the result of the function, so the function is complete.

It’s the part I bolded above that I wonder about: why is it that after reaching the first value the function is complete? Was ‘do’ introduced in order to avoid things like this that you see in OCaml?:

let _ = (some expression)

What are the alternatives to this use of ‘do’ in Opa’s language design? How else could this have been approached (from a language design standpoint).

  • 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-23T18:21:48+00:00Added an answer on May 23, 2026 at 6:21 pm

    There is no straight answer.
    do is needed with the current OPA syntax, but we could have chosen another philosophy.

    For example:

    user_update(x) =
      line = <div>
         <div>{x.author}:</div>
         <div>{x.text}</div>
      </div>
      do Dom.transform([#conversation +<- line ])
      Dom.scroll_to_bottom(#conversation)
    

    do is needed to know that the function doesn’t end at the Dom.transform line, but the next one. As written in the book you quoted: “…once we have reached the first value, we have the result of the function, so the function is complete.”

    But with a js-like syntax it could have been:

    user_update(x) {
      line = <div>
         <div>{x.author}:</div>
         <div>{x.text}</div>
      </div>;
      Dom.transform([#conversation +<- line ]);
      Dom.scroll_to_bottom(#conversation)
    }
    

    We have already received plenty of feedback and suggestions for the OPA syntax, and we are trying to find the best approach. You can read this article to know more:

    Crowdsourcing the OPA syntax
    http://dutherenverseauborddelatable.wordpress.com/2011/05/30/crowdsourcing-the-syntax/

    Read the comments as well. 😉

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

Sidebar

Related Questions

I don't think I'm missing anything. Then again I'm kind of a newbie. def
Think about doing this: import matplotlib.pyplot as plt plt.plot(x_A,y_A,'g--') plt.plot(x_B,y_B,'r-o') plt.show() How would you
Think I have an integer array like this: a[0]=60; a[1]=321; a[2]=5; now I want
Think about the following: Your ISP offers you a dynamic ip-address (for example 123.123.123.123).
I am going through the Jobeet tutorial for symfony newbies. The server returns err
I think the question is a bit silly, but for a newbie startup building
Think my problem is I am trying to sum a count in the same
Think: tiling my emacs window with eshells, a la xmonad. Is this possible? I
I'm going to do a wpf application using MVVM(It based on http://www.codeproject.com/KB/WPF/MVVMQuickTutorial.aspx ). This
I'm starting out learning some ASP.Net programming and I'm going to be making a

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.