Replies: 2 comments 1 reply
-
By convention, almost all built in types have TcLc ("BumpyCase") names, and those that do have a corresponding method and sub of the same name that is an explicit type coercion from any other type to the named built in type. Thus To elaborate on what I mean by a "list" I'll start with what I wrote in my answer to an SO asking what a "list" was in Raku:
Notably, a "list" doesn't refer to an unordered list of anything. It's definitely ordered. A hash is not a list. But a "list" is a more general notion than than a A "cache" in the context of |
Beta Was this translation helpful? Give feedback.
-
FWIW I introduced the List method during the GLR, mostly as an internal tool
because many methods use arrays internally to collect results and I didn't
want to leak this implementation detail. So I added List as a fast way to
convert that Array to a less powerful List. The irony being that it actually
didn't see much use because you can't just re-use an Array's storage for a
List object if you don't know that the array is going to be thrown away
anyway.
Anyway any inconsistencies and confusion is caused by this. It's not part of
some great design.
|
Beta Was this translation helpful? Give feedback.
-
Hi,
this topic seemed like something that isn't an issue per se but probably is worth clarifying.
There is a method
List
defined on a couple of types: https://docs.raku.org/routine/List. The behavior is not described that well but the core idea seems to be clear: this is a conversion method.There is another method
list
defined on a good number of types: https://docs.raku.org/routine/list. My main question is: what is this, conceptually? When is it invoked? What purpose does it serve? It seems to be invoked at least under some circumstances when one uses @ as a sigil, that seems to be one use. By the way, why is the name so similar to.List
? Should this be read like the verb "to list"?I have also seen
cache
used a couple of times and apparently that's also defined onAny
: https://docs.raku.org/routine/cache. This is apparently different from whatlist
does for thePositionalBindFailover
but then again I feel uncertain what.list
does in that case.Beta Was this translation helpful? Give feedback.
All reactions