Stream: beginners

Topic: `*` wildcard type in primitives


view this post on Zulip Michael “Rosy” Luder-Rosefield (Feb 27 2025 at 02:43):

Feeling pretty stupid here, but I'm not sure what the wildcard is doing in, say, -1 : Num * is. -1 is just a Num, as far as I can tell, it doesn't contain an associated unknown type, and I'm not sure what an 'open' Num would even mean....

view this post on Zulip Hannes (Feb 27 2025 at 04:07):

I'm on mobile, so a quick explanation is that a number literal can be used as any number type, if you have a function that takes an I8 then you can pass -1 to it, and you can use the same -1 in a function that takes an F64

view this post on Zulip Brendan Hansknecht (Feb 27 2025 at 07:19):

Yeah, exactly that, so Num (Integer Signed8) vs Num (FloatingPoint Binary64)


Last updated: Jul 06 2025 at 12:14 UTC