caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] Custom let bindings
@ 2012-01-20 12:39 Mehdi Dogguy
  2012-01-20 12:47 ` Yaron Minsky
  2012-01-22 10:23 ` Xavier Leroy
  0 siblings, 2 replies; 6+ messages in thread
From: Mehdi Dogguy @ 2012-01-20 12:39 UTC (permalink / raw)
  To: caml users

Hi,

I noticed that Alain Frisch tried to add custom let bindings (see r11894
and r11906) but it was reverted later on (see r11960) because no
consensus was reached (among OCaml Core team, I guess). AFAIR, I don't
remember seeing this on the caml-list. I'd personally vote for its
inclusion as I can see some uses for it. As any syntaxic sugar, it is
something we can live without but it could make things easier to read or
to express.

FTR, the proposal is to add the following:

	“let.e0 p = e1 in e2” will be expanded to “e0 e1 (fun p -> e2)”.

I'm not sure which part of the proposal was not agreed on (the syntaxic 
details "let.e0" or the whole proposal). Any input from the core team 
would be appreciated.

What do others think about it?

Regards,

-- 
Mehdi Dogguy

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Caml-list] Custom let bindings
  2012-01-20 12:39 [Caml-list] Custom let bindings Mehdi Dogguy
@ 2012-01-20 12:47 ` Yaron Minsky
  2012-01-22 10:23 ` Xavier Leroy
  1 sibling, 0 replies; 6+ messages in thread
From: Yaron Minsky @ 2012-01-20 12:47 UTC (permalink / raw)
  To: Mehdi Dogguy; +Cc: caml users

[-- Attachment #1: Type: text/plain, Size: 1654 bytes --]

We use monads quite a bit, and the lack of a monadic syntax has been a
long-running issue for us at Jane Street.  I'd love to see some kind of
monadic syntax land.  I've seen the proposal, and it seems highly
plausible.  Also, having a special operator (let!) has been proposed as
part of this I believe, and that seems like a good idea too.

y

On Fri, Jan 20, 2012 at 7:39 AM, Mehdi Dogguy <mehdi@dogguy.org> wrote:

> Hi,
>
> I noticed that Alain Frisch tried to add custom let bindings (see r11894
> and r11906) but it was reverted later on (see r11960) because no
> consensus was reached (among OCaml Core team, I guess). AFAIR, I don't
> remember seeing this on the caml-list. I'd personally vote for its
> inclusion as I can see some uses for it. As any syntaxic sugar, it is
> something we can live without but it could make things easier to read or
> to express.
>
> FTR, the proposal is to add the following:
>
>        “let.e0 p = e1 in e2” will be expanded to “e0 e1 (fun p -> e2)”.
>
> I'm not sure which part of the proposal was not agreed on (the syntaxic
> details "let.e0" or the whole proposal). Any input from the core team would
> be appreciated.
>
> What do others think about it?
>
> Regards,
>
> --
> Mehdi Dogguy
>
> --
> Caml-list mailing list.  Subscription management and archives:
> https://sympa-roc.inria.fr/**wws/info/caml-list<https://sympa-roc.inria.fr/wws/info/caml-list>
> Beginner's list: http://groups.yahoo.com/group/**ocaml_beginners<http://groups.yahoo.com/group/ocaml_beginners>
> Bug reports: http://caml.inria.fr/bin/caml-**bugs<http://caml.inria.fr/bin/caml-bugs>
>
>

[-- Attachment #2: Type: text/html, Size: 2138 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Caml-list] Custom let bindings
  2012-01-20 12:39 [Caml-list] Custom let bindings Mehdi Dogguy
  2012-01-20 12:47 ` Yaron Minsky
@ 2012-01-22 10:23 ` Xavier Leroy
  2012-01-22 10:43   ` Jonathan Protzenko
  2012-01-22 15:18   ` Jacques Carette
  1 sibling, 2 replies; 6+ messages in thread
From: Xavier Leroy @ 2012-01-22 10:23 UTC (permalink / raw)
  To: caml-list

On 01/20/2012 01:39 PM, Mehdi Dogguy wrote:

> I noticed that Alain Frisch tried to add custom let bindings (see r11894
> and r11906) but it was reverted later on (see r11960) because no
> consensus was reached (among OCaml Core team, I guess). 

Yes.  We Caml developers spent a lot of time arguing about the merits and
demerits of various syntaxes for monadic lets and other forms of
generalized let bindings, discussing usability, generality, etc.
There were some unexpected surprises, e.g. Lwt's concurrency monad
needing a special monadic "let ... and ... in ..."  binding, which
makes sense for this particular monad but not for others.

In the end, we decided that none of the proposals is something we can
commit on and put (forever) in the core language.  This is one of the
cases that is currently best handled by Camlp4 syntax extensions,
either specific to a monad (Lwt) or more general (pa_monad).

Regards,

- Xavier Leroy

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Caml-list] Custom let bindings
  2012-01-22 10:23 ` Xavier Leroy
@ 2012-01-22 10:43   ` Jonathan Protzenko
  2012-01-22 12:18     ` ivan chollet
  2012-01-22 15:18   ` Jacques Carette
  1 sibling, 1 reply; 6+ messages in thread
From: Jonathan Protzenko @ 2012-01-22 10:43 UTC (permalink / raw)
  Cc: caml-list

Hi folks,

I've put a raw, not pretty dump of the discussion at 
<http://pauillac.inria.fr/~protzenk/let-bang.html>. We didn't reach any 
consensus there, and we've covered the subject extensively. I'm just 
publishing it if anyone's interested.

Please refrain from adding any extra messages to this thread, unless 
you have arguments that make one proposal *clearly, objectively better 
than the others*. There's been enough back-and-forth already, so any 
arguments such as "/me likes" or "just pick any one of them" will be 
happily dismissed.

Thanks,

jonathan

On Sun 22 Jan 2012 11:23:45 AM CET, Xavier Leroy wrote:
> On 01/20/2012 01:39 PM, Mehdi Dogguy wrote:
>
>> I noticed that Alain Frisch tried to add custom let bindings (see r11894
>> and r11906) but it was reverted later on (see r11960) because no
>> consensus was reached (among OCaml Core team, I guess).
>
> Yes.  We Caml developers spent a lot of time arguing about the merits and
> demerits of various syntaxes for monadic lets and other forms of
> generalized let bindings, discussing usability, generality, etc.
> There were some unexpected surprises, e.g. Lwt's concurrency monad
> needing a special monadic "let ... and ... in ..."  binding, which
> makes sense for this particular monad but not for others.
>
> In the end, we decided that none of the proposals is something we can
> commit on and put (forever) in the core language.  This is one of the
> cases that is currently best handled by Camlp4 syntax extensions,
> either specific to a monad (Lwt) or more general (pa_monad).
>
> Regards,
>
> - Xavier Leroy
>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Caml-list] Custom let bindings
  2012-01-22 10:43   ` Jonathan Protzenko
@ 2012-01-22 12:18     ` ivan chollet
  0 siblings, 0 replies; 6+ messages in thread
From: ivan chollet @ 2012-01-22 12:18 UTC (permalink / raw)
  To: Jonathan Protzenko; +Cc: caml-list

[-- Attachment #1: Type: text/plain, Size: 2438 bytes --]

pretty enough.
In general, I think these read-only discussions from the caml-devel mailing
list are of great educational value for students and ocaml users, and would
deserve their very own public archive like what has been done for the
general caml mailing list.


On Sun, Jan 22, 2012 at 10:43 AM, Jonathan Protzenko <
jonathan.protzenko@gmail.com> wrote:

> Hi folks,
>
> I've put a raw, not pretty dump of the discussion at <
> http://pauillac.inria.fr/~**protzenk/let-bang.html<http://pauillac.inria.fr/%7Eprotzenk/let-bang.html>>.
> We didn't reach any consensus there, and we've covered the subject
> extensively. I'm just publishing it if anyone's interested.
>
> Please refrain from adding any extra messages to this thread, unless you
> have arguments that make one proposal *clearly, objectively better than the
> others*. There's been enough back-and-forth already, so any arguments such
> as "/me likes" or "just pick any one of them" will be happily dismissed.
>
> Thanks,
>
> jonathan
>
>
> On Sun 22 Jan 2012 11:23:45 AM CET, Xavier Leroy wrote:
>
>> On 01/20/2012 01:39 PM, Mehdi Dogguy wrote:
>>
>>  I noticed that Alain Frisch tried to add custom let bindings (see r11894
>>> and r11906) but it was reverted later on (see r11960) because no
>>> consensus was reached (among OCaml Core team, I guess).
>>>
>>
>> Yes.  We Caml developers spent a lot of time arguing about the merits and
>> demerits of various syntaxes for monadic lets and other forms of
>> generalized let bindings, discussing usability, generality, etc.
>> There were some unexpected surprises, e.g. Lwt's concurrency monad
>> needing a special monadic "let ... and ... in ..."  binding, which
>> makes sense for this particular monad but not for others.
>>
>> In the end, we decided that none of the proposals is something we can
>> commit on and put (forever) in the core language.  This is one of the
>> cases that is currently best handled by Camlp4 syntax extensions,
>> either specific to a monad (Lwt) or more general (pa_monad).
>>
>> Regards,
>>
>> - Xavier Leroy
>>
>>
> --
> Caml-list mailing list.  Subscription management and archives:
> https://sympa-roc.inria.fr/**wws/info/caml-list<https://sympa-roc.inria.fr/wws/info/caml-list>
> Beginner's list: http://groups.yahoo.com/group/**ocaml_beginners<http://groups.yahoo.com/group/ocaml_beginners>
> Bug reports: http://caml.inria.fr/bin/caml-**bugs<http://caml.inria.fr/bin/caml-bugs>
>
>

[-- Attachment #2: Type: text/html, Size: 3265 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Caml-list] Custom let bindings
  2012-01-22 10:23 ` Xavier Leroy
  2012-01-22 10:43   ` Jonathan Protzenko
@ 2012-01-22 15:18   ` Jacques Carette
  1 sibling, 0 replies; 6+ messages in thread
From: Jacques Carette @ 2012-01-22 15:18 UTC (permalink / raw)
  To: Xavier Leroy; +Cc: caml-list

That discussion was extremely enlightening.  I read every single message 
carefully, then thought about it for a while, THEN I composed this 
message.  Then thought some more before sending it.

There is one place where things seem to have gone off the rails: Lwt's 
concurrency pattern is *not* a (generic) monadic pattern.  What Lwt does 
here is to overload Caml's "let .. and ..." to mean (essentially) 
Classen's 'Fork' monad transformer [1]; one could probably interpret it 
via MonadZip as well.  It is also worthwhile remembering that, in 
Haskell concurrency is not handled via monads at all, and that 
parallelism is handled monadically is very recent [2].  It is Lwt which 
is over-reaching here, and it is not a flaw in Nicolas's proposal, or 
Alain's variant.  There are sufficiently many use-cases for "sequential 
bind" to have a special syntax for that; a special syntax for parallel 
bind can be developed later, as a further extension [esp. as Jérémie 
found a 23:1002 ratio of parallel bind to sequential bind amongst users 
of Lwt!].

As one heavy user of monads, and a co-author of pa_monad, I can 
definitely say that the original let! proposal would be extremely useful 
to me.  If it could be made to mesh nicely with a (generic) monadic 
interface, that would be sufficient.  As Xavier's extensive code shows, 
monads work now in OCaml.  The only question that remains is a nice bit 
of syntactic sugar that 'fits' OCaml, like the 'do' notation fits Haskell.

To make a specific proposal:  why not adopt the pa_monad syntax (or 
variant thereof)?  The implementation would have to be modernized to use 
all the wonderful 3.12 features, but otherwise seems to fit the other 
use cases rather well.

On 22/01/2012 5:23 AM, Xavier Leroy wrote:
> In the end, we decided that none of the proposals is something we can 
> commit on and put (forever) in the core language. This is one of the 
> cases that is currently best handled by Camlp4 syntax extensions, 
> either specific to a monad (Lwt) or more general (pa_monad). 

Note that pa_monad has not been certified to work properly with 3.12.  I 
have tried to do some further work with Camlp4 (which required changes 
to Camlp4 itself), and was not successful - the bootstrapping steps are 
simply too fragile.  pa_monad is, unfortunately, likely to bit-rot over 
time.

As a stop-gap, I think I will ask Oleg which patch he prefers (Nicolas' 
or Alain's), and get that pushed onto ber-metaocaml, so that part of my 
work can benefit from this.  [I have some 'pure' OCaml code which will, 
unfortunately, have to do without.]

Jacques C.

[1] http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.39.8039
[2] http://research.microsoft.com/~simonpj/papers/parallel


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2012-01-22 15:18 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-20 12:39 [Caml-list] Custom let bindings Mehdi Dogguy
2012-01-20 12:47 ` Yaron Minsky
2012-01-22 10:23 ` Xavier Leroy
2012-01-22 10:43   ` Jonathan Protzenko
2012-01-22 12:18     ` ivan chollet
2012-01-22 15:18   ` Jacques Carette

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).