Improvements to simple literals

Hi all,

In case there is interest, we landed a design change to integer/float literals in Mojo, taking advantage of newly improved dependent type support in the language. If you’re interested in the rationale and background, you can read more in the proposal doc checked into the repository.

-Chris

3 Likes

I just want to say it’s great you and the Modular team are taking the time to tackle technical debt rather ploughing ahead and leaving a mess of short-term fixes behind.

2 Likes

Thanks and good job !

1 Like

About the “Optional Syntax - Improve the return syntax”, why can’t we just use “pass” on the body of those dunder methods when the struct doesn’t need any state? When we use __init__ it’s definitely possible, but when trying to replicate the init, let’s say with:

struct Something:
    fn __init__(out self):  # works
        pass

    @staticmethod
    fn new(out self: Self):  # 'self' is uninitialized at the implicit return from this function
        pass

Seems like init is always required, and out doesn’t really initializes the variable. It only works it it’s already initialized by an init.

1 Like