I guess it should say "any number type", but I'm not 100% sure. Am I right?

Thank you for the answer. I'm not good at computer science, so I'm often 
can't decide is this mistake or is there some subtlety that I'm missing.

Small mistake and typos are quite common in blogs and talks and I am always 
quite unsettled by them (long story why). Unfortunately, they can be also 
in the presented code, at least in talks that I saw. "Never trust yourself, 
always run compiler" seems be the moral of the story.

As a aside, today I found in "Why Generics?" 
(https://blog.golang.org/why-generics) at the end of the section "Ordered 
types" sentence "In practice this contract would probably go into the 
standard library. and so really the Min function". Punctuation in natural 
languages is beyond me, but I guess changing period to coma make it correct.

PS. I know that now Go has Type Parameters Proposal 
(https://go.googlesource.com/proposal/+/refs/heads/master/design/43651-type-parameters.md),
 
but I need to wrap my head around generics, so I try to read as much as 
possible, even about outdated things like contracts.

Kamil
wtorek, 17 sierpnia 2021 o 21:20:25 UTC+2 Ian Lance Taylor napisaƂ(a):

> On Tue, Aug 17, 2021 at 9:13 AM Kamil Ziemian <kziem...@gmail.com> wrote:
> >
> > I'm now rereading post "Constants" and in the last section "Numbers" 
> there is a text
> >
> > BEGINNING
> > Therefore, although they have different implicit default types, written 
> as untyped constants they can be assigned to a variable of any integer type:
> >
> > var f float32 = 1
> > var i int = 1.000
> > var u uint32 = 1e3 - 99.0*10.0 - 9
> > var c float64 = '\x01'
> > var p uintptr = '\u0001'
> > var r complex64 = 'b' - 'a'
> > var b byte = 1.0 + 3i - 3.0i
> >
> > fmt.Println(f, i, u, c, p, r, b)
> > END
> >
> > I guess it should say "any number type", but I'm not 100% sure. Am I 
> right?
>
> I think you're right.
>
> Ian
>

-- 
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 golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/8bfe4d66-470f-42c0-b33d-35e16a89be33n%40googlegroups.com.

Reply via email to