Including additional conversions


There are many cases in which I find myself needing to convert a Class multiple times in a row, some can be added to streamline this.

Real>>Boolean      Instead of Real>>Integer>>Boolean
Boolean>>Real      Instead of Boolean>>Integer>>Real
Symbol>>Name       Instead of Symbol>>String>>Name

Additionally, anything that can be converted to a String can be converted to a Symbol by converting to the String Class first.

Instead of

Vector3!xyz(1 2 3)>>String>>Symbol

You can just use this, by defining the >>Symbol conversion to include the >>String conversion

Vector3!xyz(1 2 3)>>Symbol

I think that these should be included in the Core overlay in order to make conversions as straightforward as possible

Additionally, something that may not be a good idea to include would be List conversions for most Classes e.g.

1.0>>List     //would give {1.0}
"Hello">>List //would give {"Hello"}

//Using this, you could create lists like this (all other conversions are implicit);
"Hello ">>List + "this ">> + "is ">> + "a ">> + "list.">>
//Which would give you {"Hello ", "this ", "is ", "a ", "list."}
//Though I'm not sure if this would have much use


Sure, some additional conversion methods are probably a good idea.

The SkookumScript Core overlay is still in its infancy in some ways. At the same time, it is good to pick and choose the features that will really be used and what should not be used in a shipping game. One of the things that some people like about :sk: is that it is lean.

Why do you want to convert a Real to a Boolean? :face_with_raised_eyebrow:
Sometimes the test you would do might even be more succinct and explanatory:
real ~= 0 versus real<>Boolean

Though if you can omit the type it is pretty short real<>.

We plan to have optional overlays with functionality that you can easily add or remove as needed to help keep things lean and clean.

You can of course easily extend the existing overlays yourself. You could make Core-extras and Engine-extras overlays or something similar. You could submit these overlays or specific routines or classes to us to included them in the standard. We are happy to receive community additions. We might accept them as they are, modify them or not add them for whatever reason though in principle it is great.

List ideas

(Probably should be separate post)

I like the idea of making any object into a list. Could probably do it right now and have parameters that looked like () List{ThisClass_} I’ll think on the syntax and how you would write a routine a bit. :thinking:

As for the stringization of the list you could just make a list:
{"Hello ", "this ", "is ", "a ", "list."}

If you have an existing list that you want to add to, you can just use:

!strs: {"Hello"}
strs.appending("this ", "is ", "a ", "list.")

If you have two lists to concatenate:

!strs1: {"Hello"}
!strs2: {"this ", "is ", "a ", "list."}
strs1 += strs2
// or return a new list
strs1 + strs2


I’ve found it as a quick way to create a random Boolean with a distribution; using the Random Class’ methods and converting the resulting Real

!r : Random! 
if r.thorn<> []

I agree, adding this to the Core overlay wouldn’t make a lot of sense for most users of SK, the more modular optional overlay idea is the way to go.


Yeah, this probably wouldn’t be considered to be a standard Real->Boolean conversion which is num ~= 0. For a distribution the conversion would probably be num >= .5