|
|
|
|
|
by abecedarius
3373 days ago
|
|
What does a type being built-in do for you extra? In ES6 you can define a template string builder which you could name, for instance, ipv4, and then when you want an IPv4 address literal you say ipv4`192.168.0.1`
and get your object. Are there other benefits besides a literal syntax? (Not to slag on Red. One advantage I can see is avoiding the call at runtime to the ipv4 function.) |
|
Red doesn't have all types in place yet (e.g. date! is coming, and maybe an @ref type, among others), but can still load the following:
Here's a quick console session showing what types it found: And you can parse at that level: Of course, you could do something similar in ES6. If you use template literals, your data might look like this: Sorry for getting carried away. :)