Ah, maybe my assumptions were just wrong. All I knew was that something like this is not possible: # can't use `Anonymous` as return type proc test(): Anonymous = type Anonymous = object x: int y: int result = Anonymous(x: 0, y: 0)
But it looks like objects can already be anonymous, because this seem to work: proc test(): auto = type Anonymous = object x: int y: int result = Anonymous(x: 0, y: 0) Not being able to write out the type explicitly feels weird though. And things get messy when structural equivalence matters: proc testA(): auto = type Anonymous = object x: int y: int result = Anonymous(x: 0, y: 0) proc testB(): auto = type Anonymous = object x: int y: int result = Anonymous(x: 0, y: 0) # this works echo testA() == testA() # this doesn't echo testA() == testB() So maybe objects aren't too far away to replace named tuples already. But I have to say that I still like the simplicity of named tuples a lot and will surely miss the nice syntax .