You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by GitBox <gi...@apache.org> on 2021/04/12 20:05:20 UTC

[GitHub] [groovy] tomikoskinen opened a new pull request #1558: GROOVY-9017 DGM methods

tomikoskinen opened a new pull request #1558:
URL: https://github.com/apache/groovy/pull/1558


   https://issues.apache.org/jira/browse/GROOVY-9017
   
   Instead of making keywords for and, or and not, we added a Boolean not() method in DefaultGroovyMethods to get most of what was wanted. DGM already had a or() and and() methods.
   
   This PR was made by:
   @tomikoskinen
   @jonspe
   @Justsofun
   @rhanlol


-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [groovy] tomikoskinen commented on pull request #1558: GROOVY-9017 DGM methods

Posted by GitBox <gi...@apache.org>.
tomikoskinen commented on pull request #1558:
URL: https://github.com/apache/groovy/pull/1558#issuecomment-818686976


   @eric-milles We made a new Pull Request.
   Also is it intended that when you call `null.or(true)` it throws an exception, but when you call `true.or(null)` it returns true?


-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [groovy] eric-milles commented on pull request #1558: GROOVY-9017 DGM methods

Posted by GitBox <gi...@apache.org>.
eric-milles commented on pull request #1558:
URL: https://github.com/apache/groovy/pull/1558#issuecomment-818272553


   Also, when you submit for Pull Request, could you squash your commits to just one unless there is value in the separation?  The ranges change got merged without a squash and now we have over a dozen commit lines for a single feature change.


-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [groovy] tomikoskinen closed pull request #1558: GROOVY-9017 DGM methods

Posted by GitBox <gi...@apache.org>.
tomikoskinen closed pull request #1558:
URL: https://github.com/apache/groovy/pull/1558


   


-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [groovy] eric-milles commented on pull request #1558: GROOVY-9017 DGM methods

Posted by GitBox <gi...@apache.org>.
eric-milles commented on pull request #1558:
URL: https://github.com/apache/groovy/pull/1558#issuecomment-818282665


   There is a commented-out `negate` method in there.  Can you delete it as part of this change?  Also, why return null?  Do `and`, `or`, `xor` and `implies` return null?  Would "!Boolean.TRUE.equals(left)" satisfy your truth table?


-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [groovy] eric-milles commented on pull request #1558: GROOVY-9017 DGM methods

Posted by GitBox <gi...@apache.org>.
eric-milles commented on pull request #1558:
URL: https://github.com/apache/groovy/pull/1558#issuecomment-818278260


   Also, you have GROOVY-9797 changes as part of this PR.


-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [groovy] eric-milles commented on pull request #1558: GROOVY-9017 DGM methods

Posted by GitBox <gi...@apache.org>.
eric-milles commented on pull request #1558:
URL: https://github.com/apache/groovy/pull/1558#issuecomment-818749740


   If you wan't "null.or(true)" to work, you would need to provide DGM "or(NullObject,Boolean)".  This may be worth creating a separate JIRA issue for consideration.  Or you can use "or" in this fashion to be null-safe "null?.or(true)".


-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [groovy] eric-milles commented on pull request #1558: GROOVY-9017 DGM methods

Posted by GitBox <gi...@apache.org>.
eric-milles commented on pull request #1558:
URL: https://github.com/apache/groovy/pull/1558#issuecomment-818271807


   `and` and `or` work because they are binary operations so you can write "if (a.and(b))".  `not` is a unary operation semantically.  So the way you have it you could have "if (a.not())".  Are you looking for "if (not(a))"?  For that, you could supply a DGM like this:
   ```java
   public static Boolean not(Object self, Boolean target)
   ```
   With this, you could write "if (not(a))" and "self" would the the object that is the implicit "this", which you can ignore.


-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org