mgroovy commented on a change in pull request #1660:
URL: https://github.com/apache/groovy/pull/1660#discussion_r762617139
##########
File path: src/main/java/groovy/lang/NamedValue.java
##########
@@ -0,0 +1,24 @@
+package groovy.lang;
+
+public class NamedValue<T> {
Review comment:
The feature is also not growing in scope per se: My initial proposal was
to introduce the NV/NVL macros we have used for a long time now for the benefit
of all Groovy 2.5 users. These macros literally create a name, together with
the corresponding value, hence the macro name "NV". Paul then suggested we
postpone this to Groovy 3, and then to Groovy 4, to give people time for
feedback, and later proposed a less powerful but more runtime efficient NV
macro implementation, that always just returns a "name=$value" GString,
instead of NamedValue objects which have the advantage that they can be stored
as such and/or processed further.
Since that gives only part of the functionality we use, I proposed to rename
Paul's macros SV for "stringify variable", since a) that is what they do, and
b) it would have allowed us to keep our more powerful NV macros, for which it
is evidently hard to find another good, concise name. I also proposed that the
most powerful solution would of course be to introduce both SV and NV macros in
parallel, since they offer different benefits/tradeoffs to the user. That is
what Paul evidently decided to do now, some time later, as I learned yesterday.
The only thing I then finally suggested, was to add the toString functionality
I posted above to the NamedValue class, for the reasons/benefits given.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]