Mirror of
forum.nim-lang.org
index
7791 :: Interesting post from D forum
[2021-04-15T07:46:19+02:00]
View Orginal
bpr
(orginal)
[2021-04-15T07:46:19+02:00]
view original
This post
caught my eye. Nim also has**void**. I don't know how much trouble it causes, but I wonder why Nim didn't go with a unit type instead?
Araq
(orginal)
[2021-04-15T08:05:14+02:00]
view original
I think we could map
void
to
tuple[]
but many special cases would remain because Nim emphasizes
discard foo()
vs
foo()
, throwing away information is explicit in Nim. And it's not negotiable, Nim's discard feature is one of its many strengths.
xigoi
(orginal)
[2021-04-15T10:27:47+02:00]
view original
Would it be a problem to make
tuple[]
a discardable type, since it carries no information?
Araq
(orginal)
[2021-04-15T11:53:58+02:00]
view original
It's a probably a good idea and could simplify our type system and compiler. Right now
void
surely is annoying to support in the compiler. :-)