caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* Re: [Caml-list] why is the forward pipe operator (>|) so little  used?
       [not found] <1595278357.2147341.1286043752455.JavaMail.root@zmbs4.inria.fr>
@ 2010-10-03 14:15 ` Thomas.Gazagnaire
  2010-10-03 15:57   ` Yaron Minsky
  0 siblings, 1 reply; 3+ messages in thread
From: Thomas.Gazagnaire @ 2010-10-03 14:15 UTC (permalink / raw)
  To: ben kuin; +Cc: caml-list

I believe it is considered as good practice in F# to use the forward type
operator, only because of visual-studio "intellisense", ie. tab completion
using types information available at write-time.

So suppose you a variable x already typed in your environment, if you write :
$ x |> map (fun elt -> elt.
at this point visual studio can infer the type of elt and show to the
programmer which 'methods' he can call on it.

if you do the normal way, you can't infer the type of elt at write-time.
imho, the impact on style and readability is only a fortunate side-effect
:-)

--
Thomas

> hi
> Reading a few introduction F# articles and presentations I made the
> observation that the forward pipe operator is widely popular. Its also
> a language feature that, when it comes  up on blogposts or on
> stackoverflow, its  presented as a special F# feature.
> In the Ocaml world the pipe doesn't have a special place. I doesn't
> come up in any of the Ocaml Books (print or pdf) and hardly any
> internet articles or blog posts. For example Jon Harrop mentions the
> pipe in one of his F# books but not in the Ocaml for Scientists book.
> Looking at the mentioned F# code, I think the usage of the pipe has an
> ( imho positive) impact on the style and the readability of the code.
> But obviously the proficient Ocaml folks don't use it - could someone
> may explain the reason(s)?
> thanks
> ben
>
> _______________________________________________
> Caml-list mailing list. Subscription management:
> http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
> Archives: http://caml.inria.fr
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs
>


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

* Re: [Caml-list] why is the forward pipe operator (>|) so little used?
  2010-10-03 14:15 ` [Caml-list] why is the forward pipe operator (>|) so little used? Thomas.Gazagnaire
@ 2010-10-03 15:57   ` Yaron Minsky
  0 siblings, 0 replies; 3+ messages in thread
From: Yaron Minsky @ 2010-10-03 15:57 UTC (permalink / raw)
  To: Thomas.Gazagnaire; +Cc: ben kuin, caml-list

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

For what it's worth, at Jane Street, we use it all the time (although we
spell it |!, not |>).  Not for intellisense, but because it makes certain
kinds of transformation code easier to understand.

y

On Sun, Oct 3, 2010 at 10:15 AM, <Thomas.Gazagnaire@inria.fr> wrote:

> I believe it is considered as good practice in F# to use the forward type
> operator, only because of visual-studio "intellisense", ie. tab completion
> using types information available at write-time.
>
> So suppose you a variable x already typed in your environment, if you write
> :
> $ x |> map (fun elt -> elt.
> at this point visual studio can infer the type of elt and show to the
> programmer which 'methods' he can call on it.
>
> if you do the normal way, you can't infer the type of elt at write-time.
> imho, the impact on style and readability is only a fortunate side-effect
> :-)
>
> --
> Thomas
>
> > hi
> > Reading a few introduction F# articles and presentations I made the
> > observation that the forward pipe operator is widely popular. Its also
> > a language feature that, when it comes  up on blogposts or on
> > stackoverflow, its  presented as a special F# feature.
> > In the Ocaml world the pipe doesn't have a special place. I doesn't
> > come up in any of the Ocaml Books (print or pdf) and hardly any
> > internet articles or blog posts. For example Jon Harrop mentions the
> > pipe in one of his F# books but not in the Ocaml for Scientists book.
> > Looking at the mentioned F# code, I think the usage of the pipe has an
> > ( imho positive) impact on the style and the readability of the code.
> > But obviously the proficient Ocaml folks don't use it - could someone
> > may explain the reason(s)?
> > thanks
> > ben
> >
> > _______________________________________________
> > Caml-list mailing list. Subscription management:
> > http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
> > Archives: http://caml.inria.fr
> > Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> > Bug reports: http://caml.inria.fr/bin/caml-bugs
> >
>
> _______________________________________________
> Caml-list mailing list. Subscription management:
> http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
> Archives: http://caml.inria.fr
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs
>

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

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

* Re: [Caml-list] why is the forward pipe operator (>|) so little used?
  2010-10-02 18:22 ben kuin
@ 2010-10-02 22:45 ` Hezekiah M. Carty
  0 siblings, 0 replies; 3+ messages in thread
From: Hezekiah M. Carty @ 2010-10-02 22:45 UTC (permalink / raw)
  To: ben kuin; +Cc: caml-list

On Sat, Oct 2, 2010 at 2:22 PM, ben kuin <benkuin@gmail.com> wrote:
> hi
> Reading a few introduction F# articles and presentations I made the
> observation that the forward pipe operator is widely popular. Its also
> a language feature that, when it comes  up on blogposts or on
> stackoverflow, its  presented as a special F# feature.
> In the Ocaml world the pipe doesn't have a special place. I doesn't
> come up in any of the Ocaml Books (print or pdf) and hardly any
> internet articles or blog posts. For example Jon Harrop mentions the
> pipe in one of his F# books but not in the Ocaml for Scientists book.
> Looking at the mentioned F# code, I think the usage of the pipe has an
> ( imho positive) impact on the style and the readability of the code.
> But obviously the proficient Ocaml folks don't use it - could someone
> may explain the reason(s)?
> thanks
> ben
>

Ben,

A ( |> ) operator is provided in Batteries.  I use it quite
frequently.  I expect that others do as well.

That said, most books stick to the standard library.  It is therefore
less likely that they would use such an operator unless it is defined
in the text of the book.

Hez


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

end of thread, other threads:[~2010-10-03 15:57 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <1595278357.2147341.1286043752455.JavaMail.root@zmbs4.inria.fr>
2010-10-03 14:15 ` [Caml-list] why is the forward pipe operator (>|) so little used? Thomas.Gazagnaire
2010-10-03 15:57   ` Yaron Minsky
2010-10-02 18:22 ben kuin
2010-10-02 22:45 ` [Caml-list] " Hezekiah M. Carty

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).