# Syntax missed opporunities, or else?

**URL:** <https://forums.fsharp.org/t/syntax-missed-opporunities-or-else/3099>\
**Category:** Uncategorized\
**Created:** [May 15, 2023, 5:33am UTC](https://forums.fsharp.org/t/syntax-missed-opporunities-or-else/3099 "2023-05-15T05:33:22Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![systems](https://yyz2.discourse-cdn.com/flex030/user_avatar/forums.fsharp.org/systems/32/585_2.png) [@systems](https://forums.fsharp.org/u/systems)\
**Post date:** [May 15, 2023, 5:33am UTC](https://forums.fsharp.org/t/syntax-missed-opporunities-or-else/3099/1 "2023-05-15T05:33:22Z")

</div>

Hi when binding a value with explicit type we use

`let x:float = 1`

so this to me says, x returns a float  
but when binding a function we use

`let add (x:float) (y:float) :float = x + y`

when I honestly first guessed the syntax to be

`let add:float x:float y:float = x+y`

obviously this wont work, but it looks nice and seem more inuitive , why was the former syntax chosen over the later  
(note also the syntax `let add x:float y:float :float = x + y` dont work you need the brackets  
🙂

---

<div class="post-metadata">

**Author:** ![ntwilson](https://yyz2.discourse-cdn.com/flex030/user_avatar/forums.fsharp.org/ntwilson/32/984_2.png) [@ntwilson](https://forums.fsharp.org/u/ntwilson)\
**Post date:** [May 15, 2023, 3:40pm UTC](https://forums.fsharp.org/t/syntax-missed-opporunities-or-else/3099/2 "2023-05-15T15:40:49Z")

</div>

That particular syntax was brought over from OCaml, so probably nobody building F# was ever involved in that decision. It might be hard to track down the roots of that decision when it was made for OCaml.

That said, I tend to like the syntax as it is, so I have a guess why that decision was made. I like it mainly because I often look at and think about functions in terms of their type signature. So if I have

```auto
let fn (x:string) (y:int) : float = ...

```

I find it very natural that the type signature is `fn : string -> int -> float`.  
If `fn` was defined as

```auto
let fn:float x:string y:int = ...

```

it would be a little roundabout to have `fn : string -> int -> float`. It would just take more mental gymnastics on my part.

Ultimately though I think it’s just a preference thing. There are perfectly valid reasons why someone would prefer the syntax that you proposed, and perfectly valid reasons someone would prefer the existing syntax. I do like how your proposed syntax makes the parentheses unnecessary.
