I agree. But there's something that can be done to help make the
operators even more usable.
Example: named foreach loops over objects:
struct TestStruct
{
public:
this(string text) { _text = text.dup; }
int opApply(string name : "text")(int delegate(ref dchar) dg)
{
int resul
On Wed, 05 Oct 2011 13:26:26 +0300, Gor Gyolchanyan
wrote:
Example: named foreach loops over objects:
You can achieve almost exactly this by iterating over a delegate (define a
method with the same signature as opApply). The only change at the call
site is that instead of "foreach(ref c
I didn't know that was possible! Thanks!
But the case with the ternary operator is the most interesting one.
On Wed, Oct 5, 2011 at 2:54 PM, Vladimir Panteleev
wrote:
> On Wed, 05 Oct 2011 13:26:26 +0300, Gor Gyolchanyan
> wrote:
>
>> Example: named foreach loops over objects:
>
> You can achiev
Gor Gyolchanyan , dans le message (digitalmars.D:146100), a écrit :
> I agree. But there's something that can be done to help make the
> operators even more usable.
> Example: named foreach loops over objects:
>
> struct TestStruct
> {
> public:
> this(string text) { _text = text.dup; }
>
>
The whole point was to put the question mark to a better use.
I mean, it's used in the ternary operator exclusively.
It's such a waste of a token.
The question mark logically belongs to bools (which goes good with the
ternary operator), but the bools are much more ofter worked with in
the form of p
Gor Gyolchanyan wrote:
> The whole point was to put the question mark to a better use.
> I mean, it's used in the ternary operator exclusively.
> It's such a waste of a token.
> The question mark logically belongs to bools (which goes good with the
> ternary operator), but the bools are much more
I never wanted it to be a part of an identifier. I wanted it to be an
overloadable operator.
'-' already is an overloadable operator, so it can be put to many uses.
'#' is, as i know, used in the shebang and the line specifier. I don't
know if it will be unambiguous to use it as an operator.
On Th