Yadda yadda yadda operator

Hello.

I was reading about perl6 on wikipedia for amusement today and I came
upon
the “yadda yadda yadda” operator:

if is_true() {
for @array {

}
}

The three dots above (…) are syntactically valid in Perl 6 and are
called
the “yadda-yadda operator”. “…” can be used as a placeholder for code
to
be inserted later. If a running program attempts to execute “…”,
however, an exception http://en.wikipedia.org/wiki/Exception_handling
is
thrown. This operator is useful for abstract
methodshttp://en.wikipedia.org/wiki/Abstract_method,
or for marking places where the programmer intends to insert code later.

This seemed so useful that I thought implementing it for Ruby and
submitting
a patch, but then caught myself and wrote:

class Kernel

def yadda

raise "Yadda operator reached"

end

end

How elegant Ruby is.

Does anyone else think that this is Standard Library material in the
making?

To be frank, no.

j`ey
http://www.eachmapinject.com

On Jul 23, 2006, at 2:06 PM, Son SonOfLilit wrote:

  ...

thrown. This operator is useful for abstract
a patch, but then caught myself and wrote:

How elegant Ruby is.

Does anyone else think that this is Standard Library material in
the making?

This strikes me as a little comical. I think the raise solution is
preferable cause then you can include human readable information
about why it’s not implemented.
e.g.:

def foo
raise “Foo must be overridden in child classes”
end

def bar
raise “To be implemented in 1.2”
end

yadda, yadda… :slight_smile:

To me, this is much more useful than a message that’s basically “Hey
it’s broke. Deal with it.”

If you find yourself using similar messages, then just implement the
kernel function like you did. But maybe make it something like
“raise_abstract” just to make it clear to the user what’s happening.
-Mat

Son SonOfLilit wrote:

}
}

The three dots above (…) are syntactically valid in Perl 6 and are called
the “yadda-yadda operator”. “…” can be used as a placeholder for code to
be inserted later. If a running program attempts to execute “…”,
however, an exception http://en.wikipedia.org/wiki/Exception_handling is
thrown. This operator is useful for abstract
methodshttp://en.wikipedia.org/wiki/Abstract_method,
or for marking places where the programmer intends to insert code later.

Well, I guess the question is: how does one insert code later? If you
just have to redine it as one does now, why bother, just use raise
“dude, where’s my code!”. OTOH, if there some mean by which one inject
code into these locations, well, the use of this would be more
interesting. But I’m not sure how that’s done if all you has to go on
is ‘…’. Also, implemenation might prove a little hairy.

T.

Hi –

On Mon, 24 Jul 2006, Son SonOfLilit wrote:

}

raise “Yadda operator reached”

Does anyone else think that this is Standard Library material in the making?

No. It’s easy enough, and clearer, to do:

or whatever you like.

David

Hi –

On Mon, 24 Jul 2006, [email protected] wrote:

or whatever you like.

I think I misunderstood the original thing (namely, that it’s supposed
to raise an exception). Still, I’m perfectly happy with the
(admittedly less cutesy :slight_smile: technique:

raise

or some variant thereof.

David

but can we really live on, knowing that perl has a “yadda yadda” operator and
ruby does not? g we should at least have a “yabba dabba do”, shouldn’t we?

I have a theory that programming languages die with version 6.
Now this yadda yadda thing only confirms it… :wink:

Regards,
Rimantas

Rimantas L. [email protected] wrote:

but can we really live on, knowing that perl has a “yadda yadda” operator and
ruby does not? g we should at least have a “yabba dabba do”, shouldn’t we?

I have a theory that programming languages die with version 6.
Now this yadda yadda thing only confirms it… :wink:

Only a theory, or anecdotical proof as well ? :slight_smile:

I have a theory that programming languages die with version 6.
Now this yadda yadda thing only confirms it… :wink:

Only a theory, or anecdotical proof as well ? :slight_smile:

This very much depends on how you define “death” of programming
language.

VB6 (it is interesting that VB started as “Ruby”).
Perl6, PHP6, Java6 - who will choose them over Ruby? :wink:

Regards,
Rimantas

[email protected] wrote:

I think I misunderstood the original thing (namely, that it’s supposed
to raise an exception). Still, I’m perfectly happy with the
(admittedly less cutesy :slight_smile: technique:

raise

or some variant thereof.

David

but can we really live on, knowing that perl has a “yadda yadda”
operator and
ruby does not? g we should at least have a “yabba dabba do”, shouldn’t
we?

cheers

Simon

yadda operators are not supposed to stay till production.

I don’t know what’s the exact intended use. I don’t think there is. I’ll
tell you how /I/ would use it (at least how I envision myself using it):

yadda is for when you want to leave a piece of code for later.

You can write a loop or if clause and it won’t act differently because
of
emtypness. Also, when (if) you get there you’ll know why stuff doesn’t
behave right - because you didn’t implement it yet.

That’s why ‘…’ is in my opinion such good syntax for it (but in Ruby
would
require to change the parsing yadda yadda yadda).

Another nice thing is that when you are preparing code for release you
can
easily *grep yadda *(or fgrep …) and make sure that nothing is left
over.

Simple raise won’t do that for me.

Side note: I’m not a Seinfeld fan. I’ve in fact almost never watched it,
and
did not watch the yadda-yadda-yadda episode (was it an episode?).

I only refer to it this way because perl does and it makes sense to me.

It would also never get used for other things in my source so the search
won’t give false positives.

The implementation isn’t perfect - something that gives more info would
be
even better - but it’s so simple…

It’s something so basic and useful that I really don’t think it deserves
it’s own require.

If no one else does, then I guess I’ll have to stick it in a header.

I hope other people will too benefit from the idea (call me an idiot but
up
to now I had inconsistent behaviour on cases where this would be used -
raise or do nothing or print a random useless flow of information
regarding
execution).

And you could change it to:

def yadda(*comment)
raise "Yadda point reached. Comment: " + comment.shift.to_str
end

Aur.

<…>

Another nice thing is that when you are preparing code for release you can
easily *grep yadda *(or fgrep …) and make sure that nothing is left
over.

Simple raise won’t do that for me.
<…>
And you could change it to:

def yadda(*comment)
raise "Yadda point reached. Comment: " + comment.shift.to_str
end

Well, you can use raise “Yadda …your comment here” and grep will
work again :slight_smile:

Regards,
Rimantas

Interesting… I thought that only I had been adversely affected by the
Inky Foxes intro to Ruby. It seems to be viral in nature, more
widespread than I had could have imagined.

Oh, the horror.

Burt

Le 23 juillet 2006 à 20:43, [email protected] a écrit :

Well, I guess the question is: how does one insert code later? If you
just have to redine it as one does now, why bother, just use raise
“dude, where’s my code!”. OTOH, if there some mean by which one inject
code into these locations, well, the use of this would be more
interesting. But I’m not sure how that’s done if all you has to go on
is ‘…’. Also, implemenation might prove a little hairy.

Well, I’m sure it’s possible to do something that would react like
this :

class Foo
abstract :bar, :baz
end

class Quux < Foo
def bar()
puts “Hello.”
end
end

q = Quux.new()
q.bar
=> “Hello”
q.baz
=> exception “Baz must be implemented in child.”

Now, is that useful, pretty, ruby’ish, and whatever, I don’t know.

And it’s limited to methods (and / or accessors ?).

Fred

Rimantas L. wrote:

I have a theory that programming languages die with version 6.
Now this yadda yadda thing only confirms it… :wink:

Only a theory, or anecdotical proof as well ? :slight_smile:

This very much depends on how you define “death” of programming language.

VB6 (it is interesting that VB started as “Ruby”).
Perl6, PHP6, Java6 - who will choose them over Ruby? :wink:
Yeah … but Java 5 is really Java 1.5. :slight_smile:

I’m guessing I’ll live to see Ruby 3 … not sure beyond that. Matz, how
about skipping some numbers so we can catch up?

Simon Kröger wrote:

ruby does not? g we should at least have a “yabba dabba do”, shouldn’t we?

yabba dabba don’t

On Jul 23, 2006, at 10:01 PM, M. Edward (Ed) Borasky wrote:

Perl6, PHP6, Java6 - who will choose them over Ruby? :wink:
Yeah … but Java 5 is really Java 1.5. :slight_smile:

I think it’s actually Java2 1.5 SE rev 5… plus alpha. turbo.
champion edition.
-Mat

Ahh, and one more thing:

The yadda operator is great when writing tutorials:

In the perl 6 wikipedia page there are many coe snippets that are
familiar
to whoever tried some read or write operator on a tutorial… Except
that
now they are legal syntax:
"Perl 6 introduces true formal parameters to the language. In Perl 6, a
subroutine declaration looks something like this:

sub do_something(Str $thing, Int $other) { … }"

"The following changes greatly improve the readability of regexes

  • Simplified non-capturing groups: […] which are the same as Perl
    5’s: (?:…)"

"class RGB_Color is Tuple[int,3] & Color { … }

sub get_tint (RGB_Color|CMYK_Color $color, num $opacity where 0 <=
$^opacity <= 1) { … }
sub store_record (Record&Storable $rec) { … }"

Seems so unelegant to me when it’s illegal but I am still forced to
use something of the sorts that when it’s suddenly a legal language
construct it hit me with elegancy and I ran off to eat some bacon
before I’d be drawn by the evil snoopy cursing perl, be it’s destiny
#^#&@^ous.

OK, I’ll stop bothering everyone with the stupid seinfeld operator :stuck_out_tongue:

Aur

Mat S. wrote:

I think it’s actually Java2 1.5 SE rev 5… plus alpha. turbo.
champion edition.
-Mat

I think that’s the version that Capcom is using to write Street Fighter
4.

–Errant

Mat S. wrote:

language.

VB6 (it is interesting that VB started as “Ruby”).
Perl6, PHP6, Java6 - who will choose them over Ruby? :wink:
Yeah … but Java 5 is really Java 1.5. :slight_smile:

I think it’s actually Java2 1.5 SE rev 5… plus alpha. turbo.
champion edition.
-Mat
I wouldn’t know … never driven it at night.