Jared Hester

My feedback

  1. 21 votes
    Vote
    Sign in
    Check!
    (thinking…)
    Reset
    or sign in with
    • facebook
    • google
      Password icon
      Signed in as (Sign out)
      You have left! (?) (thinking…)
      0 comments  ·  F# Language  ·  Flag idea as inappropriate…  ·  Admin →
      Jared Hester supported this idea  · 
    • 5 votes
      Vote
      Sign in
      Check!
      (thinking…)
      Reset
      or sign in with
      • facebook
      • google
        Password icon
        Signed in as (Sign out)
        You have left! (?) (thinking…)
        6 comments  ·  F# Language  ·  Flag idea as inappropriate…  ·  Admin →
        Jared Hester commented  · 

        I also find this warning very useful and it definitely should not be removed. Reed's alternative is a much more useful approach.

        If you forget to bind to `use` with the `new` right there, that's on you ;P

        If the real issue is with how it currently can't be pipelined, why not ask for just that instead?

      • 13 votes
        Vote
        Sign in
        Check!
        (thinking…)
        Reset
        or sign in with
        • facebook
        • google
          Password icon
          Signed in as (Sign out)
          You have left! (?) (thinking…)
          5 comments  ·  F# Language  ·  Flag idea as inappropriate…  ·  Admin →
          Jared Hester commented  · 

          Another option would be to move `mod` from the set of keywords in "mlcompatibility" mode to the standard language keywords

          Jared Hester commented  · 

          ` %. ` should be that operator

        • 131 votes
          Vote
          Sign in
          Check!
          (thinking…)
          Reset
          or sign in with
          • facebook
          • google
            Password icon
            Signed in as (Sign out)
            You have left! (?) (thinking…)
            under review  ·  11 comments  ·  F# Language  ·  Flag idea as inappropriate…  ·  Admin →
          • 248 votes
            Vote
            Sign in
            Check!
            (thinking…)
            Reset
            or sign in with
            • facebook
            • google
              Password icon
              Signed in as (Sign out)
              You have left! (?) (thinking…)
              under review  ·  8 comments  ·  F# Language  ·  Flag idea as inappropriate…  ·  Admin →
              Jared Hester commented  · 

              Instead of a specific directive what if we could define a set of preprocessors with custom behaviors in a dll and have fsi automatically reference that assembly at startup.

            • 13 votes
              Vote
              Sign in
              Check!
              (thinking…)
              Reset
              or sign in with
              • facebook
              • google
                Password icon
                Signed in as (Sign out)
                You have left! (?) (thinking…)
                1 comment  ·  F# Language  ·  Flag idea as inappropriate…  ·  Admin →
                Jared Hester commented  · 

                This would be great. If custom operators could take other custom operators as arguments it'd be even better.

              • 4 votes
                Vote
                Sign in
                Check!
                (thinking…)
                Reset
                or sign in with
                • facebook
                • google
                  Password icon
                  Signed in as (Sign out)
                  You have left! (?) (thinking…)
                  3 comments  ·  F# Language  ·  Flag idea as inappropriate…  ·  Admin →
                  Jared Hester commented  · 

                  However this would not be consistent with the rules for computation expressions.

                  "Sequence expressions are an example of a computation expression, as are asynchronous workflows and query expressions." [1]

                  If you're using a seq expr it should be able to take advantage of complex internal logic, recursive looping, lifting nested sequences with yield!, etc.
                  Vasily is right, if all you want is a simple sequence use

                  seq [10;55;0] or seq [| 40; 5; 0; 40 |]|

                  Perhaps that error should be improved to say "invalid sequence expression ..." with some more details and a suggestion

                  [1] https://msdn.microsoft.com/en-us/visualfsharpdocs/conceptual/computation-expressions-%5Bfsharp%5D

                • 20 votes
                  Vote
                  Sign in
                  Check!
                  (thinking…)
                  Reset
                  or sign in with
                  • facebook
                  • google
                    Password icon
                    Signed in as (Sign out)
                    You have left! (?) (thinking…)
                    4 comments  ·  F# Language  ·  Flag idea as inappropriate…  ·  Admin →
                    Jared Hester commented  · 

                    JSON presents several issues for use as a configuration file

                    - doesn't support comments
                    - no bare keys
                    - fussy commas
                    - the abundance of braces make nesting hard to read at a glance and files tedious to edit
                    - no multi-line strings
                    - no literal strings (fully escaped)
                    - only floats, no integers
                    - no dateTime standard

                    A much better choice would be TOML[1] (Rust's choice for Cargo[2]) which addresses all of the issues listed above and every vaild TOML file maps directly to a HashTable.

                    CSON[3] addresses most of JSON's issues, but it doesn't do it as well as TOML does.

                    YAML[4] is another option, although it's more sane to read and write than JSON, it's unnecessarily complex and much more than is necessary for a project config. A subset of yaml could be used, but that adds another set of issues, so whether it'd be better than JSON in any form is up for debate.

                    So really just use TOML or CSON and please not JSON

                    [1] https://github.com/toml-lang/toml
                    [2] http://doc.crates.io/manifest.html#the-project-layout
                    [3] https://github.com/bevry/cson#what-is-cson
                    [4] https://en.wikipedia.org/wiki/YAML#Sample_document

                  • 24 votes
                    Vote
                    Sign in
                    Check!
                    (thinking…)
                    Reset
                    or sign in with
                    • facebook
                    • google
                      Password icon
                      Signed in as (Sign out)
                      You have left! (?) (thinking…)
                      3 comments  ·  F# Language  ·  Flag idea as inappropriate…  ·  Admin →
                      Jared Hester supported this idea  · 
                      Jared Hester commented  · 

                      OCaml does this like
                      -------
                      let rec range ~first:a ~last:b =
                      if a > b then []
                      else a :: range ~last:b ~first:(a+1)
                      -------

                      and with the shorthand
                      -------
                      let rec range ~first ~last =
                      if first > last then []
                      else first :: range ~first:(first+1) ~last
                      -------

                      ~first is short for ~first:first
                      ~last is short for ~last:last

                      This is also tied into optional labeled curried args that support default values [1]
                      ------
                      let rec range2 ?(step=1) a b =
                      if a > b then []
                      else a :: range ~step (a+step) b

                      > range2 1 10;;
                      val it: int list = [1; 2; 3; 4; 5; 6; 7; 8; 9; 10]

                      > range2 1 10 ~step:2;;
                      val it: int list = [1; 3; 5; 7; 9]
                      - : int list = [1; 3; 5; 7; 9]
                      ------

                      ?(step=1) means ~step is an optional argument which defaults to 1
                      also when a function only has optional args the last arg has to be unit
                      ------
                      let open_window ?title ?width ?height ()
                      ------

                      ======

                      Reason's approach is
                      ------
                      let add = fun first::f second::s => f + s;
                      let result = add second::20 first::10;
                      ------

                      Reason also uses this feature to supply default values to curried functions [2]
                      ------
                      let increment = fun by::by=0 num => num + by;
                      let two = increment by::1 1;
                      let four = increment 4;
                      ------

                      When a curried function takes optional args it's probably best to require the label always
                      be used for the optional arg.

                      Intellisense could also aid in making it clear which argument a value is being used to satisfy

                      [1] https://ocaml.org/learn/tutorials/labels.html#Usingfooinafunctioncall
                      [2] https://facebook.github.io/reason/#diving-deeper-curried-functions

                    • 30 votes
                      Vote
                      Sign in
                      Check!
                      (thinking…)
                      Reset
                      or sign in with
                      • facebook
                      • google
                        Password icon
                        Signed in as (Sign out)
                        You have left! (?) (thinking…)
                        5 comments  ·  F# Language  ·  Flag idea as inappropriate…  ·  Admin →
                        Jared Hester supported this idea  · 
                        Jared Hester shared this idea  · 
                      • 36 votes
                        Vote
                        Sign in
                        Check!
                        (thinking…)
                        Reset
                        or sign in with
                        • facebook
                        • google
                          Password icon
                          Signed in as (Sign out)
                          You have left! (?) (thinking…)
                          1 comment  ·  F# Language  ·  Flag idea as inappropriate…  ·  Admin →
                          Jared Hester shared this idea  · 
                        • 76 votes
                          Vote
                          Sign in
                          Check!
                          (thinking…)
                          Reset
                          or sign in with
                          • facebook
                          • google
                            Password icon
                            Signed in as (Sign out)
                            You have left! (?) (thinking…)
                            16 comments  ·  F# Language  ·  Flag idea as inappropriate…  ·  Admin →
                            Jared Hester commented  · 

                            [ Part 1 of 2 ]

                            I disagree with the majority of Jack's points.

                            > My chief concern is that you'd be forcing consumers of your code to use these symbols as well.

                            That's the point, it's not a detrimental aspect. When working in a specialized domain the ability to use a common and familiar set of symbols is of great benefit to reducing the overall cognitive load applied to problem solving. If a developer is using these symbols in their code, the intended consumers probably want to use them as well.

                            > code with Unicode operators is much less approachable for newcomers to F# -- especially those who don't come from a math/science-heavy background -- and I worry it would keep people away from F# who might otherwise be quite happy with the language.

                            This is a completely unrealistic fear. The kinds of code it would most likely be used in are for highly domain specific math and science projects. These are not the kind of projects that newcomers to the language would be using in the first place. Even without the Unicode glyphs it'd still be unapproachable to newcomers. But that's fine, because it's not for them. We should want to have features in the language that make it more appealing to a wider group of people than it currently does, if a language as obtuse as Haskell can reach the level of popularity that it already has, I think F# will be fine with a few more options for operators.

                            > Another drawback -- a number of mainstream development tools (including parts of VS) weren't designed with Unicode symbols in mind, and won't work properly when code or compiled assemblies use them in type/field/method names.

                            Atom, Kate, Brackets, VsCode, Sublime, Vim, Emacs, XCode, Xamarin, these tools all work fine with Unicode Symbols. I use them all the time. I even added Unicode glyph support to Ionide for Atom to make it even easier to use them. Yes the tools should be fixed to handle them properly, but there's no impetus to do so if no one needs the functionality.

                            Jared Hester commented  · 

                            [ Part 2 of 2 ]

                            > What's the downside of having an IDE plugin (like F# Power Tools), or the add-on Daniel linked to, that could recognize naming conventions for variables and convert them to Unicode characters in the IDE (but not in the actual code)?

                            This downside is that this does nothing for operators. Operators are what are in question, and converting variable names does nothing to help the fact that the set of possible operators that can be created is fairly constricted and most of them are part of the language already. Not to mention between Suave, FParsec, and Freya there aren't many you can define or use without colliding fairly quickly under 3 characters. The built in precedence rules of F# only further compound these issues `^` is going to start any operator that you want to have right associativity. Swift gets this right[1], when declaring a custom operator you declare whether it's prefix, infix, or postfix; you pick whether the associativity is left, right, or none; and you set an associativity level between 0 and 255. And operators can be created from Unicode Math, Symbol, Arrow, Dingbat, line/box drawing and Unicode combining characters.[2] One additional feature that they should have included is the ability to give your operator a named
                            alias to use during autocomplete.

                            Furthermore there's not reason to create a naming convention for variables so they can be disguised as Unicode characters while rendered, because we can just use those those characters already.

                            These are all valid binding names:
                            ʀ ʁ ʂ ʃ ʄ ʅ ʆ ʇ ʈ ʉ ʊ ʋ ʌ ʍ ʎ ʏ ʐ ʑ ʒ ʓ ʔ ʕ ʖ ʗ ʘ ʙ ʚ ʛ ʜ ʝ ʞ ʟ
                            ɀ Ɂ ɂ Ƀ Ʉ Ʌ Ɇ ɇ Ɉ ɉ Ɋ ɋ Ɍ ɍ Ɏ ɏ ɐ ɑ ɒ ɓ ɔ ɕ ɖ ɗ ɘ ə ɚ ɛ ɜ ɝ ɞ ɟ
                            ɠ ɡ ɢ ɣ ɤ ɥ ɦ ɧ ɨ ɩ ɪ ɫ ɬ ɭ ɮ ɯ ɰ ɱ ɲ ɳ ɴ ɵ ɶ ɷ ɸ ɹ ɺ ɻ ɼ ɽ ɾ ɿ
                            ʀ ʁ ʂ ʃ ʄ ʅ ʆ ʇ ʈ ʉ ʊ ʋ ʌ ʍ ʎ ʏ ʐ ʑ ʒ ʓ ʔ ʕ ʖ ʗ ʘ ʙ ʚ ʛ ʜ ʝ ʞ ʟ
                            π ρ ς σ τ υ φ χ ψ ω ϊ ϋ ό ύ ώ Ϗ ϐ ϑ ϒ ϓ ϔ ϕ ϖ ϗ Ϙ ϙ Ϛ ϛ Ϝ ϝ Ϟ ϟ
                            Ϡ ϡ Ϣ ϣ Ϥ ϥ Ϧ ϧ Ϩ ϩ Ϫ ϫ Ϭ ϭ Ϯ ϯ ϰ ϱ ϲ ϳ ϴ ϵ
                            ڀ ځ ڂ ڃ ڄ څ چ ڇ ڈ ډ ڊ ڋ ڌ ڍ ڎ ڏ ڐ ڑ ڒ ړ ڔ ڕ ږ ڗ ژ ڙ ښ ڛ ڜ ڝ ڞ ڟ
                            ᐁ ᐂ ᐃ ᐄ ᐅ ᐆ ᐇ ᐈ ᐉ ᐊ ᐋ ᐌ ᐍ ᐎ ᐏ ᐐ ᐑ ᐒ ᐓ ᐔ ᐕ ᐖ ᐗ ᐘ ᐙ ᐚ ᐛ ᐜ ᐝ ᐞ ᐟ
                            Ⅰ Ⅱ Ⅲ Ⅳ Ⅴ Ⅵ Ⅶ Ⅷ Ⅸ Ⅹ Ⅺ Ⅻ Ⅼ Ⅽ Ⅾ Ⅿ ⅰ ⅱ ⅲ ⅳ ⅴ ⅵ ⅶ ⅷ ⅸ ⅹ ⅺ ⅻ ⅼ ⅽ ⅾ ⅿ
                            ↀ ↁ ↂ Ↄ ↄ ↅ ↆ ↇ ↈ

                            And for the wide swath of glyphs and characters that cause compiler errors due to unrecognized characters if you include them in your source, all you need are some backticks

                            ``∠`` ``∡`` ``∢`` ``∣`` ``∤`` ``∥`` ``∦`` ``∧`` ``∨`` ``∩`` ``∪`` ``∫`` ``∬`` ``∭`` ``∮`` ``∯`` ``∰`` ``∱`` ``∲`` ``∳``

                            and you're free to use and abuse them as much as you please.

                            It's almost as though people fear F# will turn into APL if the operator system is improved, but it won't, because people don't want that. This is a feature that will be very beneficial to some people, and for the most part it'll have little to no effect on everyone else. But there's a still decent chance that most people will reach a point in time, maybe a few times, where having these extra capabilities was essential and incredibly useful, just like with Units Of Measure.

                            Let me be clear I don't want to use operators all the time, and I think that most of the time it's better and easier to understand code by using well named functions over glyph jumbles. My biggest issue with the current state of F# on this issue is it's very easy to make the worst kind code that fulfills and embodies all of the concerns people have brought up already. But there's no way to make and employ the symbols that would actually be useful.

                            [1] https://developer.apple.com/library/ios/documentation/Swift/Conceptual/Swift_Programming_Language/AdvancedOperators.html
                            [2] https://developer.apple.com/library/ios/documentation/Swift/Conceptual/Swift_Programming_Language/LexicalStructure.html#//apple_ref/doc/uid/TP40014097-CH30-ID418

                            Jared Hester commented  · 

                            What if it required a `#nowarn` and the Unicode characters supported for operators were limited to specific blocks, e.g. Mathematical Operators[1], Supplemental Mathematical Operators[2], and maybe even some of Miscellaneous Technical[3] ;)

                            [1] http://www.fileformat.info/info/unicode/block/mathematical_operators/utf8test.htm
                            [2] http://www.fileformat.info/info/unicode/block/supplemental_mathematical_operators/utf8test.htm
                            [3] http://www.fileformat.info/info/unicode/block/miscellaneous_technical/utf8test.htm

                          • 457 votes
                            Vote
                            Sign in
                            Check!
                            (thinking…)
                            Reset
                            or sign in with
                            • facebook
                            • google
                              Password icon
                              Signed in as (Sign out)
                              You have left! (?) (thinking…)
                              under review  ·  37 comments  ·  F# Language  ·  Flag idea as inappropriate…  ·  Admin →
                              Jared Hester commented  · 

                              This functionality does exist in the form

                              .... let inline _Data x = ( ^a : ( member Data: 'b ) x )

                              Which works in situations like -

                              .... type Bottom = { Data:string }
                              .... type Middle = { Data:Bottom }
                              .... type Top = { Data:Middle }

                              .... let top = { Data = { Data = { Data = "bottom" }}}
                              .... let inline d3 x = ( _Data >> _Data >> _Data ) x ;;
                              .... d3 top
                              .... > val it : string = "bottom"

                              The suggested `.` notation seems like it might cause issues with partial application unless surrounded by parens, so it's probably better to use a different operator as a unary operator on an identifier to create a function like _Data. Some possibilities are

                              .... ( @. ) ___( @.Data ) <- my favorite option
                              .... ( .@ ) ___( .@Data )
                              .... ( @| ) ___( @|Data )
                              .... ( |@ ) ___( |@Data )
                              .... ( =| ) ____( =|Data )
                              .... ( |= ) ____( |=Data )
                              .... ( |- ) ____ ( |-Data )
                              .... ( -| ) ____ ( -|Data )
                              .... ( ./ ) ____ ( ./Data )
                              .... ( /. ) ____ ( /.Data )
                              .... ( |. ) ____ ( |.Data )
                              .... ( .| ) ____ ( .|Data )
                              .... ( !. ) ____ ( !.Data )
                              .... ( *@ ) ___ ( *@Data )
                              .... ( @* ) ___ ( @*Data )
                              .... ( -@ ) ___ ( -@Data )
                              .... ( @- ) ___ ( @-Data )
                              .... ( |* ) ____ ( |*Data )
                              .... ( *| ) ____ ( *|Data )

                              ( these are all currently valid operators )

                            • 219 votes
                              Vote
                              Sign in
                              Check!
                              (thinking…)
                              Reset
                              or sign in with
                              • facebook
                              • google
                                Password icon
                                Signed in as (Sign out)
                                You have left! (?) (thinking…)
                                5 comments  ·  F# Language  ·  Flag idea as inappropriate…  ·  Admin →
                              • 392 votes
                                Vote
                                Sign in
                                Check!
                                (thinking…)
                                Reset
                                or sign in with
                                • facebook
                                • google
                                  Password icon
                                  Signed in as (Sign out)
                                  You have left! (?) (thinking…)
                                  18 comments  ·  F# Language  ·  Flag idea as inappropriate…  ·  Admin →
                                • 492 votes
                                  Vote
                                  Sign in
                                  Check!
                                  (thinking…)
                                  Reset
                                  or sign in with
                                  • facebook
                                  • google
                                    Password icon
                                    Signed in as (Sign out)
                                    You have left! (?) (thinking…)
                                    16 comments  ·  F# Language  ·  Flag idea as inappropriate…  ·  Admin →

                                  Feedback and Knowledge Base