UFCS and templates

2021-01-20 Thread xigoi
Honestly, I'd probably just teach them how it works in general and when they crash into this issue, explain why it doesn't work here.

UFCS and templates

2021-01-20 Thread xigoi
UFCS can be used if the left argument is something that by itself has a type. Unfortunately, Nim still doesn't have first-class iterators, which is the reason why you can't use UFCS on them.

UFCS and templates

2021-01-20 Thread ggibson
> UFCS can be used if the left argument is something that by itself has a type That is more or less how I think about it when programming Nim. Is that phrasing how you would recommend teaching newcomers about UFCS?

UFCS and templates

2021-01-20 Thread ggibson
What's your workflow to know what you can and cannot use UFCS on? And especially how do you teach newcomers UFCS? I am tempted to err on the side of: * Use an IDE (like alaviss' nvim plugin) that shows you the type of what you're writing, and then * Only use UFCS for procs and funcs and NOTH