Bend icon indicating copy to clipboard operation
Bend copied to clipboard

(Request) String-casting numbers for print()

Open ematth opened this issue 1 year ago • 2 comments

I think it would be great if print() could cast number arguments (uint, int, float, etc.) into Strings by default, or at least accept numbers without first needing a String cast. For example:

def func(x):
  return x + 1

def main():
  with IO:
    b <- print(func(x)) 
    return wrap(b)

As opposed to b <- print(*some-string-cast*(func(x))). This would be make returning large amounts of computation results a little cleaner.

ematth avatar May 30 '24 17:05 ematth

It definitely could do that, since numbers and constructors have a different memory representation.

developedby avatar May 30 '24 19:05 developedby

Hi! I would like to open a PR to implement this, if possible. I just need some help knowing where to start and I can work on it

mateuseap avatar May 31 '24 16:05 mateuseap