btbytes / nim-cookbook

Nim Programming Cookbook
http://nim-cookbook.btbytes.com/
Other
51 stars 7 forks source link

Syntax for aliasing #21

Open wizzardx opened 6 years ago

wizzardx commented 6 years ago

Hi there.

Nim doesn't have a built-in alias command to rename identifiers to something more convenient (eg, D lang has that). But it's possible to get the same effect by using template metaprogramming.

Here's a couple of links with more info on that:

https://forum.nim-lang.org/t/2390

https://github.com/nim-lang/Nim/issues/7090

https://forum.nim-lang.org/t/1515

Could you please add a section for how to do aliasing?

QuinnFreedman commented 6 years ago

+1. This is my biggest annoyance with nim right now

timotheecour commented 5 years ago

But it's possible to get the same effect by using template metaprogramming.

it's not possible to do so reliably without the compiler patch in the linked PR https://github.com/nim-lang/Nim/pull/11822, see PR for details