[prev in list] [next in list] [prev in thread] [next in thread] 

List:       perl5-porters
Subject:    Re: Per-RFC: a :void subroutine attribute
From:       Shlomi Fish <shlomif () shlomifish ! org>
Date:       2022-04-02 11:13:15
Message-ID: 20220402141315.69200841 () shlomifish ! org
[Download RAW message or body]

On Fri, 1 Apr 2022 18:10:04 +0100
"Paul \"LeoNerd\" Evans" <leonerd@leonerd.org.uk> wrote:

> On Fri, 1 Apr 2022 15:36:07 +0000 (UTC)
> Ovid via perl5-porters <perl5-porters@perl.org> wrote:
> 
> > What about declaring :void subroutines? A `return` would generate a
> > warning (guess what problem arised in a client call today?)  
> 
> Ahyes - that reminds me actually that I had similar thoughts a while
> ago. I also wanted to suggest a `:scalar` attribute, with similar
> meaning. :scalar would be very handy for attributes commonly used to
> create keyvalue pairs, such as:
> 
>   my %args = (
>     red   => $obj->red,
>     green => $obj->green,
>   );
> 
> to enforce that `method red` or `method green` are definitely :scalar,
> as otherwise they appear to be list-context here.
> 

+1!

	-- Shlomi

> > * Perl would no longer need to copy data to return (a potential



-- 

Shlomi Fish       https://www.shlomifish.org/
List of Text Editors and IDEs - https://shlom.in/IDEs

  <LeoNerd> "I hear eclipse is really nice, but I'm still waiting for it to
            load."
    — Freenode's #perl

Please reply to list if it's a mailing list post - https://shlom.in/reply .
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic