develooper Front page | perl.perl6.users | Postings from September 2018

Re: .kv ?

Thread Previous | Thread Next
From:
Brad Gilbert
Date:
September 14, 2018 16:26
Subject:
Re: .kv ?
Message ID:
CAD2L-T1TEBizVPZPwwAROi8UyiLaowAgRdcK0pHGA1Fp_FEP2Q@mail.gmail.com
You can read https://en.wikipedia.org/wiki/Option_type for more information

Tell me if you find any of the Perl 6 section confusing.
https://en.wikipedia.org/wiki/Option_type#Perl_6

On Fri, Sep 14, 2018 at 6:21 AM Todd Chester <ToddAndMargo@zoho.com> wrote:
>
> >> On Fri, Sep 14, 2018 at 7:08 AM Todd Chester <ToddAndMargo@zoho.com
> >> <mailto:ToddAndMargo@zoho.com>> wrote:
> >>
> >>
> >>
> >>     On 09/14/2018 04:01 AM, Simon Proctor wrote:
> >>      > :D is a type constraint requiring an instantiated (or defined)
> >>     object of
> >>      > the given type (or a subtype of it).
> >>      >
> >>      > :U is a type constraint saying you have a container specified for
> >>     the
> >>      > given type that hasn't been instantiated.
> >>
> >>     Hi Simon,
> >>
> >>     Your went over my head.  What the heck is "instantiated"?
> >>
> >>     https://www.dictionary.com/browse/instantiate
> >>     verb (used with object), in·stan·ti·at·ed, in·stan·ti·at·ing.
> >>
> >>           to provide an instance of or concrete evidence in support
> >>           of (a theory, concept, claim, or the like).
> >>
> >>     I am not connecting the dots.
> >>
> >>     Is there a list of these guys somewhere, or are these the only two?
> >>
> >>     -T
> >>
>
>
>
> On 09/14/2018 04:16 AM, Curt Tilmes wrote:
> > See
> > https://docs.perl6.org/type/Signature#Constraining_defined_and_undefined_values
> >
> > If I say "my Int $x",
> > $x is now an Int, but an undefined Int.
> >
> > If I say "my Int $x = 42",
> > $x is an Int, but set to a defined value, 42.
> >
> > Both are Int:
> >
> > say 42 ~~ Int; # OUTPUT: «True␤»
> > say Int ~~ Int; # OUTPUT: «True␤»
> >
> >
> > There are three type constraint suffixes you can add -- :D (defined), :U
> > (undefined) or :_ (defined or undefined)
> >
> > # Checking a type object
> > say Int ~~ Any:D; # OUTPUT: «False␤»
> > say Int ~~ Any:U; # OUTPUT: «True␤»
> > say Int ~~ Any:_; # OUTPUT: «True␤»
> > # Checking an object instance
> > say 42 ~~ Any:D; # OUTPUT: «True␤»
> > say 42 ~~ Any:U; # OUTPUT: «False␤»
> > say 42 ~~ Any:_; # OUTPUT: «True␤»
> >
> >
> >
>
> Hi Curt,
>
> Beautiful explanation!  I am writing it down tomorrow
> in my keepers file.
>
> Thank you!
>
> -T

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About