void foo(int loc) { return bar[loc]; } then foo($) would essentilly become foo(&) becomes ==> return bar[$]; instead of having do to thinks like foo(bar.length). The usefulness comes from the case when bar is local: void foo(int loc) { auto bar = double[RandomPInt+1]; return bar[loc]; }then foo($) always returns a value and the outside world does not need to know about foo. Since $ is a compile thing expression and not used anywhere else this can always be done(it is a symbolic substitution and has a direct translation in to standard D code except $ cannot be used as arguments like this the current D language grammar).
Would be nice to be able to pass $ as a function argument to be
used in automatic path length traversing.
- Passing $ as a function argument James Japherson via Digitalmars-d
- Re: Passing $ as a function argumen... bauss via Digitalmars-d
- Re: Passing $ as a function argumen... bachmeier via Digitalmars-d
- Re: Passing $ as a function argumen... Simen Kjærås via Digitalmars-d
- Re: Passing $ as a function arg... James Japherson via Digitalmars-d
- Re: Passing $ as a function... Dennis via Digitalmars-d
- Re: Passing $ as a func... James Japherson via Digitalmars-d
- Re: Passing $ as a... Neia Neutuladh via Digitalmars-d
- Re: Passing $ as a... bachmeier via Digitalmars-d
- Re: Passing $ as a function... crimaniak via Digitalmars-d
- Re: Passing $ as a function... Simen Kjærås via Digitalmars-d