Skip to content

Add syntactic sugar for installing nullary methods#4091

Merged
d-torrance merged 2 commits intoMacaulay2:developmentfrom
d-torrance:install-method
Jan 14, 2026
Merged

Add syntactic sugar for installing nullary methods#4091
d-torrance merged 2 commits intoMacaulay2:developmentfrom
d-torrance:install-method

Conversation

@d-torrance
Copy link
Copy Markdown
Member

As proof of concept, use it for all the nullary methods defined in Core.

For example:

i1 : foo = method()

o1 = foo

o1 : MethodFunction

i2 : foo () := () -> print "Hello, world!"

o2 = FunctionClosure[stdio:2:10-2:37]

o2 : FunctionClosure

i3 : foo()
Hello, world!

Inspired by #4090 (comment). I'm not sure why this wasn't implemented before. It's mentioned as a possibility in the docs, and it's literally just one line of code!

@d-torrance d-torrance requested a review from mahrud January 13, 2026 21:53
Comment thread M2/Macaulay2/m2/debugging.m2
Comment thread M2/Macaulay2/m2/integers.m2 Outdated
As proof of concept, use it for all the nullary methods defined in
Core and Probability (which we bump to v0.7).
@d-torrance d-torrance merged commit ec4ff64 into Macaulay2:development Jan 14, 2026
8 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants