FluxML / IRTools.jl

Mike's Little Intermediate Representation
MIT License
111 stars 36 forks source link

typo #29

Closed musm closed 5 years ago

musm commented 5 years ago

A couple of comments on the documentation.

Could we get some documentation or clarification for what self actually refers to or does? To me it's not that clear.

Also using @dynamo with dispatch kinda seems a bit magical at this point to me. It would be good if there were some further explanation/examples of how it works?

Otherwise thanks for this package.

MikeInnes commented 5 years ago

This is meant to be we ... let dispatch ..., in which case it would be correct (but I see why you might have read it differently).

self just refers to the function/dynamo you're currently working with. After you've returned it, it gets replaced with %1 or whatever argument represents that function.

A @dynamo is nothing but a normal method (the same as a generated function as well). If you call foo(f, x), dispatch decides whether you hit the dynamo method or a different method that runs normal code.

Does that clear things up? Happy to keep discussing and we can hopefully work out how the docs can be clearer.

musm commented 5 years ago

Ah sorry for the noise, you are right.

Thank you for the clarification. I would appreciate it if self was described in the docs, which would help other readers.