Re: OOP Macro section of Nim by Example doesn't seem to work

2017-07-29 Thread bkerin
> Maybe you won't even need macros, because you can get done a lot already with > generics and iterators on object members. I've been poking through the nim docs a lot but haven't run into a discussion of this approach?

Re: OOP Macro section of Nim by Example doesn't seem to work

2017-07-27 Thread jyapayne
[PR](https://github.com/flaviut/nim-by-example/pull/53) made!

Re: OOP Macro section of Nim by Example doesn't seem to work

2017-07-27 Thread jyapayne
@jlp765 I was going to do it but got stuck with work. I'll PR when I get a minute!

Re: OOP Macro section of Nim by Example doesn't seem to work

2017-07-26 Thread bkerin
It worked for me with the one change of "self" to "this", with nim 0.16.0, but with 0.17.0 the (slighly less pleasant looking, but possibly perfectly reasonable as I have no idea about quote) version with the extra result = that jyapayne provided was needed.

Re: OOP Macro section of Nim by Example doesn't seem to work

2017-07-26 Thread jlp765
So someone is doing a pull request to [Nim By Example](https://github.com/flaviut/nim-by-example) to fix this, right?

Re: OOP Macro section of Nim by Example doesn't seem to work

2017-07-25 Thread jyapayne
It looks like there's just an issue trying to use "quote do:" in that if else expression.

Re: OOP Macro section of Nim by Example doesn't seem to work

2017-07-25 Thread jyapayne
Hmm, for some reason it didn't work in the above macro. I wrongly assumed it was removed.

Re: OOP Macro section of Nim by Example doesn't seem to work

2017-07-25 Thread andrea
> I'm not sure if this used to work because right now in Nim, you can't assign > the result of an if ... else expression to a variable. Of course you can, `if` is an expression in Nim (as well as in many other languages)

Re: OOP Macro section of Nim by Example doesn't seem to work

2017-07-25 Thread jyapayne
You can make the oop_macro work with the following changes: Change result = if exported: # mark `typeName` with an asterisk quote do: type `typeName`* = ref object of `baseName` else: quote do: type `typeName` = re

Re: OOP Macro section of Nim by Example doesn't seem to work

2017-07-25 Thread zetashift
Also on: [http://nim-by-example.github.io/seqs](http://nim-by-example.github.io/seqs)/ Last example on this page uses 'def' to define a procedure instead of proc!

Re: OOP Macro section of Nim by Example doesn't seem to work

2017-07-25 Thread Krux02
Truth to be told, Nim is not yet Nim 1.0 and there is no 100% guarantee that code that you write will always work in the future. But I use a lot of metaprogramming and breaking changes are very rare. But normally when things change, the language wants you to improve your code and changes are ver

OOP Macro section of Nim by Example doesn't seem to work

2017-07-24 Thread bkerin
I don't fully understand it for sure but my impression is the contents of the big second-to-last box on this page: > [https://nim-by-example.github.io/oop_macro](https://nim-by-example.github.io/oop_macro)/ is supposed to build, run and produce output as shown in the last box on the page. Inst