Thread overview
[Issue 14077] Letting compiler determine length for fixed-length arrays in return type
Jan 29, 2015
Kenji Hara
Jul 05, 2017
Vladimir Panteleev
January 29, 2015
https://issues.dlang.org/show_bug.cgi?id=14077

Kenji Hara <k.hara.pg@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|Issue 14070 - Letting       |Letting compiler determine
                   |compiler determine length   |length for fixed-length
                   |for fixed-length arrays in  |arrays in return type
                   |return type                 |

--
January 29, 2015
https://issues.dlang.org/show_bug.cgi?id=14077

monkeyworks12@hotmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |monkeyworks12@hotmail.com

--- Comment #1 from monkeyworks12@hotmail.com ---
(In reply to Kenji Hara from comment #0)
> Possible case:
> 
> int[$] returnSArr()
> {
>     return [1, 2];
> }

Also consider the following:

auto[$] returnSArr()
{
    return [1, 2];
}

const[$] returnSArr()
{
    return [1, 2];
}

//Etc.


int[auto] returnAA()
{
    return ["asdf":1];
}

auto[auto] returnAA()
{
    return ["asdf":1];
}

immutable[auto[$]] returnAA()
{
    return [[1, 2]:1];
}

--
January 29, 2015
https://issues.dlang.org/show_bug.cgi?id=14077

bearophile_hugs@eml.cc changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bearophile_hugs@eml.cc

--- Comment #2 from bearophile_hugs@eml.cc ---
(In reply to monkeyworks12 from comment #1)
> (In reply to Kenji Hara from comment #0)
> > Possible case:
> > 
> > int[$] returnSArr()
> > {
> >     return [1, 2];
> > }
> 
> Also consider the following:
> 
> auto[$] returnSArr()
> {
>     return [1, 2];
> }
> 
> const[$] returnSArr()
> {
>     return [1, 2];
> }
> 
> //Etc.
> 
> 
> int[auto] returnAA()
> {
>     return ["asdf":1];
> }
> 
> auto[auto] returnAA()
> {
>     return ["asdf":1];
> }
> 
> immutable[auto[$]] returnAA()
> {
>     return [[1, 2]:1];
> }

What are the use cases for all this? Implementation efforts have a cost in time.

--
January 29, 2015
https://issues.dlang.org/show_bug.cgi?id=14077

--- Comment #3 from monkeyworks12@hotmail.com ---
(In reply to bearophile_hugs from comment #2)
> (In reply to monkeyworks12 from comment #1)
> > (In reply to Kenji Hara from comment #0)
> > > Possible case:
> > > 
> > > int[$] returnSArr()
> > > {
> > >     return [1, 2];
> > > }
> > 
> > Also consider the following:
> > 
> > auto[$] returnSArr()
> > {
> >     return [1, 2];
> > }
> > 
> > const[$] returnSArr()
> > {
> >     return [1, 2];
> > }
> > 
> > //Etc.
> > 
> > 
> > int[auto] returnAA()
> > {
> >     return ["asdf":1];
> > }
> > 
> > auto[auto] returnAA()
> > {
> >     return ["asdf":1];
> > }
> > 
> > immutable[auto[$]] returnAA()
> > {
> >     return [[1, 2]:1];
> > }
> 
> What are the use cases for all this? Implementation efforts have a cost in time.

I just put them here for completeness in case any were overlooked. I'm not specifically requesting that they are implemented as well.

--
July 05, 2017
https://issues.dlang.org/show_bug.cgi?id=14077

Vladimir Panteleev <dlang-bugzilla@thecybershadow.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |WONTFIX

--- Comment #4 from Vladimir Panteleev <dlang-bugzilla@thecybershadow.net> ---
I think this is something that would require a DIP today.

--