You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I know that this might be not so important but it might also make some code cleaner. I already took a look at #638 and realized how important is the existance for both static functions and methods inside of records. But I think a cleaner way of working with methods will also lead to cleaner code:
Right now if I want to create a constructor I have to do it this way:
But I propose a different way of building constructors and methods:
To make a constructor for an object we can simply declare a function with the same name of the record. This shouldn't cause any compatibiliy issues since Teal already doesn't allow that. But instead of giving an error, this:
About methods: I didn't include the part about methods because this is already too munch by itself so I didn't want to overload the issue. But it would work in a similar way by using the keyword "method" instead of "function" in the declaration inside the record. Just like how #638 proposed so I didn't want to repeat that.
@NotSoSeriouss Yes, this is a duplicate of #200 and #97. I'm going to close this one, but these references will create backlinks at the open issues so that your comments can be found from there as well.
I know that this might be not so important but it might also make some code cleaner. I already took a look at #638 and realized how important is the existance for both static functions and methods inside of records. But I think a cleaner way of working with methods will also lead to cleaner code:
Right now if I want to create a constructor I have to do it this way:
And to create a new method:
And
But I propose a different way of building constructors and methods:
To make a constructor for an object we can simply declare a function with the same name of the record. This shouldn't cause any compatibiliy issues since Teal already doesn't allow that. But instead of giving an error, this:
Could get automatically compiled as if it were:
And if there is no declaration of the constructor, then this would be the case:
This can allow for a nice improvement: the use of
new
which is only shugar syntax for:
The text was updated successfully, but these errors were encountered: