Skip to content

Instantly share code, notes, and snippets.

@boyzoid
Created November 29, 2012 14:21
Show Gist options
  • Save boyzoid/4169411 to your computer and use it in GitHub Desktop.
Save boyzoid/4169411 to your computer and use it in GitHub Desktop.
Grails Service
public list(){
Layout.executeQuery('from Layout where user is null')
}
public list( User user ){
Layout.executeQuery('from Layout where user = :user or user is null', [ user: user ])
}
@boyzoid
Copy link
Author

boyzoid commented Nov 29, 2012

Not sure I agree that overloading methods would 'change the core nature of the language'. Make it possible to do so, but not mandatory. Problem solved.

I disagree that dynamic argument styles are more elegant and is more elegant. Method overloading may result in more methods (more lines of code), but each method would, in my opinion, more elegant that the uber-method you would need to handle this with dynamic/optional arguments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment