Where answers come from

Some pages can ask a language model questions. Set this up once; your choice is remembered in this browser for the whole site.

Model source
Use another source instead
You sign in on OpenRouter; it gives this page a key for your account.

Groovy Class tricks

Originally published .

jwagon sent me these mind bending groovy class manipulations in a chat today:


#!/usr/bin/env groovy

class AA {

        def msg

        AA(something){ msg = something }

    }

def c = { a, b ->

 def  x =a.newInstance(b)

 println x.msg

}

c(AA, "foo")

Or how about….


#!/usr/bin/env groovy

def m = java.lang.String

def n =  m.newInstance("foo")

println n

Explore the map · Browse by topic and date