That’s fair.
Not completely and that’s also why we get a lot of invalid code…
By experiementing you collect data of what works and what not. It’s only when you know why you get the result you get that you get knowledge. Things that seems to work doesn’t really mean it works for the reason you think it works and I don’t think I need to give more examples about the undefined unsafe code that people have written.
To be clear, I have absolutely no problem with trying things around, but blinding trying things until something works is not acceptable (not what’s happening here) and when things work you should certainly have some understanding of why it works. In this case,
I was under impression from documentation QuoteNode
is needed to access the contents of __source__
is certainly the problem. If @epogrebnyak actually just get this impression by reading the text from the document, then I apologize and the doc text should be fixed instead. If this idea was concluded by reading the code (including the code examples in the doc), then that was exactly my point. Copying and pasting code without understanding is going to lead to problem like this in the future. For a complex case it might not be practical and you might not need to make any adjustment to the copied code so it’s probably fine to let it be and simply use it as a blackbox library. For a simple case like this, one should definately understand why something is needed before using the code.
Yes, I agree with this. In fact, given the previous assumption I had absolutely no issue with how this particular issue is tried out. As mentioned above, all my comments about how one should understand better is targeted to the original @__LOCATION__
/@file1
macro. Had that one be understood (or explained) better, this would not have been an issue to begin with.
I also just realize that by “understand every part of a code” I don’t mean to, well, every bit of the code, if that makes sense. I’m saying that in macro file1() QuoteNode(__source__.file) end
one should know why QuoteNode
is there but it’s certainly too much to require understanding the full semantics of macros and QuoteNode
outside the context of the particular input type/usage pattern. I think this is very basic and I don’t think that’s too much to ask. I also don’t expect people to natually do that and I certainly expect beginners to not do that and run into problem because of it.
Exactly. Again, the way this question was asked was perfectly fine. More understanding should have been extracted from the original use of QuoteNode
.
Again, all tried things in this one is fair for the knowledge known at the time. I’m only commenting on the obvious gap in understanding revealed by it. If I was not clear enough yet, doing what was done in the top post is exactly how you should try things. The result is strange this time because of a missing piece in a prevous learning that could improve easily if you ask a little more everything you get a working code.