[Issue 10819] Invalid comparison for equality of lambda functions
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Wed Aug 14 10:07:24 PDT 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10819
bearophile_hugs at eml.cc changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |bearophile_hugs at eml.cc
--- Comment #2 from bearophile_hugs at eml.cc 2013-08-14 10:07:22 PDT ---
(In reply to comment #1)
> How would you define equality for lambda functions?
You don't compute in general the equivalence of two programs. Currently if you
use the "string lambdas" then for the "a > b" and "a >b" the D compiler can't
tell they are the same. So as usual you look for a rough solution. This means
you take the expression threes of the lambdas and test if they are exactly the
same (minus whitespace and stripping away documentation comments).
Related: elsewhere people have proposed a __trait(ast, some_code_here) that
returns the syntax tree of some given code. The tree is composed of structs and
other types defined in Phobos or elsewhere, and you can process such tree
through regular user D code. I think this allows poor's man macros almost
entirely implemented in library D code. And they become a bit nicer once
"__traits(ast, ...)" is written like meta.ast(...).
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list