"string serialized <type>" syntax


#1

For example, I have a function defined like below,

getUrl: function (): string serialized Url

I could also define return value as normal string, like

getUrl: function (): string

So why should we define return value as string serialized Url? What is it good for?


#2

You would want to do that for the same reason we have a type-system - it provides additional documentation and meta information to developers and to the runtime.

In the next revision of type system fields and methods that have string serialized X value type will auto generate parse* methods to parse the string. I.e. in your example it will auto generate:

parseGetUrl: function(failIfInvalid: boolean): Url

p.s. typically it is better to persist / pass around compact string representation of a complex data structure like Url or Expr

p.p.s. please remove the silly get prefix from methods - you must nor like auto-complete :slight_smile: