digitalmars.D - Feature Request: Implicit first parameter inside scope expression.
- downs (16/16) Nov 03 2007 First, a definition.
- Robert Fraser (2/22) Nov 03 2007 Eh, too specific, unexpected and Perl-y for my tastes. Great for hacking...
- Jarrett Billingsley (3/19) Nov 04 2007 It's a very downs-esque feature. Use perl.
First, a definition.
A CallableThing shall be either a function, functor, method, delegate,
function pointer or anything else that supports the foo(parameters) syntax.
Requested feature:
When inside an index or scope expression, and a CallableThing is called
with an invalid number or type of parameters, before failing, try to
call the Thing in question with the object the index or scope belongs to
as the first parameter.
What this allows (example):
string foo="I can see you";
string bar=foo[find("can")+3..find("you")]; // " see "
What this breaks:
Nothing, as it is only triggered in situations which would be an error
under the current rules.
What do you think?
--downs
Nov 03 2007
downs Wrote:
First, a definition.
A CallableThing shall be either a function, functor, method, delegate,
function pointer or anything else that supports the foo(parameters) syntax.
Requested feature:
When inside an index or scope expression, and a CallableThing is called
with an invalid number or type of parameters, before failing, try to
call the Thing in question with the object the index or scope belongs to
as the first parameter.
What this allows (example):
string foo="I can see you";
string bar=foo[find("can")+3..find("you")]; // " see "
What this breaks:
Nothing, as it is only triggered in situations which would be an error
under the current rules.
What do you think?
--downs
Eh, too specific, unexpected and Perl-y for my tastes. Great for hacking out
small programs, but in a larger system, this unexpected rule could cause
problems for code auditing, etc.
Nov 03 2007
"downs" <default_357-line yahoo.de> wrote in message
news:fghshq$61i$1 digitalmars.com...
First, a definition.
A CallableThing shall be either a function, functor, method, delegate,
function pointer or anything else that supports the foo(parameters)
syntax.
Requested feature:
When inside an index or scope expression, and a CallableThing is called
with an invalid number or type of parameters, before failing, try to
call the Thing in question with the object the index or scope belongs to
as the first parameter.
What this allows (example):
string foo="I can see you";
string bar=foo[find("can")+3..find("you")]; // " see "
What this breaks:
Nothing, as it is only triggered in situations which would be an error
under the current rules.
What do you think?
It's a very downs-esque feature. Use perl.
Nov 04 2007









Robert Fraser <fraserofthenight gmail.com> 