Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the difference between :D and :D:?

Tags:

raku

I was browsing the Perl 6 docs on the shift routine and saw this snippet:

Defined as:

multi sub    shift(Array:D )
multi method shift(Array:D:)

I know :D means the Array is defined and not Any or Nil, but what's :D:? It's very hard to search for.

This section of the type signature docs contains more examples of the syntax, but does not (as far as I can tell) explain it.

like image 992
cat Avatar asked Feb 15 '16 21:02

cat


People also ask

What is the difference between D and D3?

There are quite a few differences between vitamin D and vitamin D3 but the main difference between them is that vitamin D is a fat-soluble vitamin that regulates calcium and phosphorous levels of the body whereas the vitamin D3 is the natural form of vitamin D produced by the body from sunlight.

Which is better vitamin D2 or D3?

Studies have repeatedly shown that vitamin D3 is superior at raising levels of vitamin D in the body. These findings were supported by a recent review of the evidence which found that vitamin D3 supplementation increased vitamin D levels in the body better than vitamin D2.

Is D2 or D3 better for osteoporosis?

They are vitamin D2 and vitamin D3. Previous research suggested that vitamin D3 was a better choice than vitamin D2. However, more recent studies show that vitamin D3 and vitamin D2 are fairly equal for bone health.

Is all vitamin D the same?

Vitamin D3 Comes from Animals, Vitamin D2 from PlantsThe two forms of vitamin D differ depending on their food sources. Vitamin D3 is only found in animal-sourced foods, whereas D2 mainly comes from plant sources and fortified foods. Since vitamin D2 is cheaper to produce, it's the most common form in fortified foods.


1 Answers

The invocant of a method gets passed as an implicit first argument. If you want to use an explicit parameter within the signature (eg to add a type smiley like :D or just to give it a more descriptive name), you need to separate it with a : instead of a , from the rest of the parameter list. This is necessary even in case of an empty list so it can be disambiguated from a signature with a regular positional parameter.

Some more information can be found in the design documents.

like image 59
Christoph Avatar answered Oct 04 '22 00:10

Christoph