www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Feature Request: Implicit first parameter inside scope expression.

reply downs <default_357-line yahoo.de> writes:
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
next sibling parent Robert Fraser <fraserofthenight gmail.com> writes:
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
prev sibling parent "Jarrett Billingsley" <kb3ctd2 yahoo.com> writes:
"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