On Thu, Aug 24, 2017 at 5:14 PM <[email protected]> wrote:
> <genType1, genType2> func (r genType1) f(x, y genType2) (z getType2, err
> error)
>
>
In a language such as OCaml, you would define `f` as:
let f r (x, y) = ...
And the system would infer the type of `f` automatically. In your case it
would probably infer something like
val f : 'a -> 'b -> 'b -> ('b * error)
which is really something along the lines of
forall 'a .
forall 'b .
val f : 'a -> 'b -> 'b -> ('b * error)
As an aside, people often say `alpha` rather than `'a` and `beta` rather
than `'b` when speaking the type out loud.
As another aside: if you don't get the above, you wouldn't have been able
to pass the first course at my university back in the day (around 2000). I
think we can expect people who become proficient programmers over time to
eventually grasp an introductory programming course. Mind you, many
languages aside from Go defines the type-level abstraction, so it is hardly
expected to be "new" anymore to a great large set of people.
Personally, I find pointer handling far more complex than the above :)
--
You received this message because you are subscribed to the Google Groups
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.