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 saw that the type signature for Saturn.Queue.push is 'a Saturn.Queue.t -> 'a -> unit while the queue in standard library has this the other way round val push : 'a -> 'a t -> unit, as i takes an element first, and then a queue, while in Saturn we take the queue first. I am wondering if there is any reason why this is done in a different way?
The text was updated successfully, but these errors were encountered:
We aim to maintain a consistent convention across all Saturn data structures. In the standard library, hash table functions always take the hash table as the first argument, whereas many other data structures (if not all), like Queue, take it as the last argument.
After some discussion, we decided that consistently placing the t type as the first argument is better. This reduces the risk of accidentally misplacing this argument, which can lead to confusing type errors.
The main downsides are that this approach doesn’t match the standard library API and prevents the use of chaining with |>. However, we believe that these drawbacks are outweighed by the benefits of having a consistent and less error-prone convention across Saturn’s data structures.
Hi,
I saw that the type signature for
Saturn.Queue.push
is'a Saturn.Queue.t -> 'a -> unit
while the queue in standard library has this the other way roundval push : 'a -> 'a t -> unit
, as i takes an element first, and then a queue, while in Saturn we take the queue first. I am wondering if there is any reason why this is done in a different way?The text was updated successfully, but these errors were encountered: