| > The examples vs Haskell are not helping me understand. Personally I don't think the added verbosity is helping in any way. It doesn't sound to me like you are the right audience for the document you're reading. Quoting from that page: > this should not be mistaken for a beginner tutorial or overview of Perl 6; it is intended as a technical reference for Perl 6 learners with a strong Haskell background. It is not wise to start with a technical reference unless you are already fairly well versed in the basics of the technology you're learning and are motivated to deepen your knowledge of it. If you are interested in P6 you should start with overview or beginner material. Then, if you have a strong Haskell background, you can refer to the technical reference if and when the overview or beginner material isn't working for you. (If you are not genuinely motivated to have fun learning P6 then nothing related to P6 will work for you. Are you genuinely motivated to have fun learning P6?) ---- > I'd like to hear opinions on how the use of sigils and the other syntax oddities If you view childishly simple and natural syntax as "oddities" then your mind is already made up that they are oddities. So the rest of this comment is intended primarily for other readers and secondarily for you on the off chance that you are able to transcend your mind's confirmation bias against the following constructs actually being simple and natural. > use of sigils Many programmers think in terms of three fundamental primitive data types from which all other datatypes are composed: * single items * collections of numbered things * collections of named things P6 adopts this view and assigns three sigils to these three abstract notions. This makes it both easier and quicker to both read and write code -- once you've learned how they work. In P5 sigils were onerously complex. In P6 they are childishly simple. So now it's also easy and quick to learn them as well as to use them.[1] > Int:D, Int:U In P6, every type that's created using any of its type constructors is a sum type with two sub-types. This includes types defined in the standard language such as Int. The sub-types are named D and U. For example, to refer to Int's D sub-type, use `Int:D`. This makes it easy and quick to read and write code once you've learned what they are. Fortunately, it's childishly simple to learn what they are.[2] > given The `given` keyword means essentially the same as the English word `given`. This makes it easy and quick to read and write code once you've learned the English meaning of `given`.[3] > when The `when` keyword hides a good deal of complexity. But one can hop on Wittgenstein's Ladder easily. Because for the first rung, it just means the same as the meaning of the English word `when` used in the context of something that's `given`. The keyword `when` makes it easy and quick to read and write code once you've learned the English meaning of `when` in the context of `given` -- and it can then be used in other contexts.[4] ---- [1] 27 second vide clip covers it all: https://www.youtube.com/watch?v=Nq2HkAYbG5o&t=10m&list=PLRuE... [2] They're called "type smilies" for a reason. :D is the definite, happy, valuable type. What's `42`? Simple. Definite. Happy. Valuable. Unlike :D, the other subtype, :U, is undefined, unhappy, not a value. What's `Int`? Is it `42`? No, because that would be defined. Every value/object is either definite/happy or it isn't. [3] From dictionary.com: given: noun: "an established fact" [4] From dictionary.com: when: conjunction: "in the event that" |
Probably your comment hints to this already in which case the following will be redundant but I wanted to mention them more explicitly. This is mainly for people unfamiliar with Perl 6.
Using the type smileys(:U, :D) are also ways to specifically match against a type object (`Int`, `Str`, `Rat`, etc.) and an instance object of a type object (-5, 'Hello', 1/5, etc.):
There is also the :_ smiley which is used by default whenever the other two aren't specified: