Re: Potential enhancement to type checking extensions

2024-05-01 Thread MG
@Both potential tweaks that I looked at did use the more general approach: Assumed as much, just wanted to emphasize this, before I argued that maybe we don't need this at all. I think my argument holds for the more general example you (or Scala) gives, I don't know if this is worth the effort,

Re: Potential enhancement to type checking extensions

2024-05-01 Thread Paul King
Thanks mg, comments inline. On Thu, May 2, 2024 at 2:51 AM MG wrote: > > Hi Paul, > > if this is to be supported, I would still argue for the more general approach. Both potential tweaks that I looked at did use the more general approach. > However, having scanned the blog post, it seems to me

Re: Potential enhancement to type checking extensions

2024-05-01 Thread MG
Hi Paul, 1. if this /is /to be supported, I would still argue for the more general approach. 2. However, having scanned the blog post, it seems to me the case for having this kind of support is quite weak. 1. E.g. change of color code library leading to assertion failing for the

Re: Potential enhancement to type checking extensions

2024-05-01 Thread Paul King
Just to come back to this discussion. The existing functionality is what I ended up using in this blog post: https://groovy.apache.org/blog/multiversal-equality In that post, you can see two code fragments that start with "afterVisitMethod" and contain code using the type checking extension DSL.

Re: Potential enhancement to type checking extensions

2024-04-09 Thread MG
Even without the deep insight into the inner workings of Groovy you guys have, I would tend to agree with Jochen here: 1. Option 4 looks to be the clean, most flexible & general option. 2. Specialized support for equality that handles or makes handling easier for both equality operator and

Re: [EXT] Re: Potential enhancement to type checking extensions

2024-04-09 Thread Milles, Eric (TR Technology) via dev
: [EXT] Re: Potential enhancement to type checking extensions External Email: Use caution with links and attachments. I also think option 4 is the right way to go. Option 3 has the benefit that both the operator and method call could be covered just by handling the method call (since the former

Re: Potential enhancement to type checking extensions

2024-04-08 Thread Paul King
I also think option 4 is the right way to go. Option 3 has the benefit that both the operator and method call could be covered just by handling the method call (since the former is converted into the latter). Option 4 might require you to cover both cases in your type extension - but that might

Re: Potential enhancement to type checking extensions

2024-04-08 Thread Jochen Theodorou
On 08.04.24 13:56, Paul King wrote: [...] What I wanted to show is the same examples but using the '==' and '!=' operators, since that would be the typical Groovy style for this scenario. Unfortunately, using the type checking extension DSL doesn't currently work for binary operators. The swap

Potential enhancement to type checking extensions

2024-04-08 Thread Paul King
Hi folks, I was putting together a blog post on supporting Multiversal Equality with Groovy. It's an optional feature in Scala 3: https://docs.scala-lang.org/scala3/book/ca-multiversal-equality.html Using the example (involving print and audio books) from the above link, we can write an ad-hoc