Search
Star
Feedback
Setup for Free
© 2026 Hedgehog Software, LLC
Twitter
GitHub
Discord
System
Light
Dark
More
Communities
Docs
About
Terms
Privacy
TraitsRequiring Static Methods - Modular
M
Modular
•
3y ago
•
11 replies
khaVulture
TraitsRequiring Static Methods
What am I doing wrong below
? please help
.
trait HasStaticMethod
:
@staticmethod
fn work
(
)
:
.
.
.
@value
struct WashingMachine
:
@staticmethod
fn work
(
)
:
print
(
"Wash the clothes
!
"
)
@value
struct Cooker
:
@staticmethod
fn work
(
)
:
print
(
"Cook the food
!
"
)
fn main
(
)
:
fn do
_work
T
: HasStaticMethod
:
T
.work
(
)
do
_work
(WashingMachine
(
)
)
Modular
Join
This server is the home of the MAX and Mojo community! Join us to chat about all things Modular.
20,199
Members
View on Discord
Resources
ModelContextProtocol
ModelContextProtocol
MCP Server
Recent Announcements
Similar Threads
Was this page helpful?
Yes
No
Similar Threads
Calling methods from list indexes
M
Modular / questions
2y ago
Large static list storage
M
Modular / questions
3y ago
RayTracing example - __add__ method (dunder methods)
M
Modular / questions
2y ago
Compiling a dynamic/static library
M
Modular / questions
17mo ago