Re[2]: [reia] Re: Reia PEG Issue 4 : and/or precedence

0 views
Skip to first unread message

Phil Pirozhkov

unread,
Aug 27, 2010, 5:36:27 AM8/27/10
to re...@googlegroups.com
By the way,

http://avdi.org/devblog/2010/08/02/using-and-and-or-in-ruby/

-----Original Message-----
From: Tony Arcieri <tony.a...@medioh.com>
To: re...@googlegroups.com
Date: Fri, 20 Aug 2010 11:04:44 -0600
Subject: Re: [reia] Re: Reia PEG Issue 4 : and/or precedence

> On Fri, Aug 20, 2010 at 9:18 AM, Lucian Branescu
> <lucian....@gmail.com>wrote:
>
> > It's helpful to have an official idiomatic style
> >
>
> Well then, I hereby declare that the official idiomatic style for Reia is
> "and" and "or" (this is also how they are stored internally in the parse
> tree in all cases). Using && and || should look as odd to a Reia user as
> using a for loop looks in Ruby.
>
> That said, when I get a chance I will correct the precedence so "and" is
> higher than "or".
>
> --
> Tony Arcieri
> Medioh! A Kudelski Brand
>
> --
> You received this message because you are subscribed to the Google Groups "Reia" group.
> To post to this group, send email to re...@googlegroups.com.
> To unsubscribe from this group, send email to reia+uns...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/reia?hl=en.
>
>
>

Tony Arcieri

unread,
Aug 27, 2010, 2:12:28 PM8/27/10
to re...@googlegroups.com
Yeah, good ol' "poetry mode", however that's not really idiomatic Ruby anymore, and I think most people would think it's weird.

Instead of:

  all_kosher? or die("oops")

idiomatic Ruby generally takes the form:

  die("oops") unless all_kosher?

I really don't see the value in supporting the old poetry mode precedence. I think most people just find it confusing.

graeme defty

unread,
Aug 28, 2010, 11:13:38 PM8/28/10
to Reia
Well after reading all that I find myself starting to lean towards the
"do it like Ruby" school of thought.

sigh.
_______________________________________________
On Aug 28, 1:12 am, Tony Arcieri <tony.arci...@medioh.com> wrote:
> Yeah, good ol' "poetry mode", however that's not really idiomatic Ruby
> anymore, and I think most people would think it's weird.
>
> Instead of:
>
>   all_kosher? or die("oops")
>
> idiomatic Ruby generally takes the form:
>
>   die("oops") unless all_kosher?
>
> I really don't see the value in supporting the old poetry mode precedence. I
> think most people just find it confusing.
>
>
>
> On Fri, Aug 27, 2010 at 3:36 AM, Phil Pirozhkov <p...@mail.ru> wrote:
> > By the way,
>
> >http://avdi.org/devblog/2010/08/02/using-and-and-or-in-ruby/
>
> > -----Original Message-----
> > From: Tony Arcieri <tony.arci...@medioh.com>
> > To: re...@googlegroups.com
> > Date: Fri, 20 Aug 2010 11:04:44 -0600
> > Subject: Re: [reia] Re: Reia PEG Issue 4 : and/or precedence
>
> > > On Fri, Aug 20, 2010 at 9:18 AM, Lucian Branescu
> > > <lucian.brane...@gmail.com>wrote:
>
> > > > It's helpful to have an official idiomatic style
>
> > > Well then, I hereby declare that the official idiomatic style for Reia is
> > > "and" and "or" (this is also how they are stored internally in the parse
> > > tree in all cases).  Using && and || should look as odd to a Reia user as
> > > using a for loop looks in Ruby.
>
> > > That said, when I get a chance I will correct the precedence so "and" is
> > > higher than "or".
>
> > > --
> > > Tony Arcieri
> > > Medioh! A Kudelski Brand
>
> > > --
> > > You received this message because you are subscribed to the Google Groups
> > "Reia" group.
> > > To post to this group, send email to re...@googlegroups.com.
> > > To unsubscribe from this group, send email to
> > reia+uns...@googlegroups.com <reia%2Bunsu...@googlegroups.com>.
> > > For more options, visit this group at
> >http://groups.google.com/group/reia?hl=en.
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Reia" group.
> > To post to this group, send email to re...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > reia+uns...@googlegroups.com <reia%2Bunsu...@googlegroups.com>.

Tony Arcieri

unread,
Aug 29, 2010, 1:12:51 AM8/29/10
to re...@googlegroups.com
I really prefer the aesthetics of "and" and "or" over "&&" and "||". However, many people are afraid to use and/or instead of &&/|| in Ruby because they find the precedence confusing.

"Poetry mode" hasn't taken off in the Ruby community and because of that and being confused by the precedence a lot of people just don't use and/or.

I think that'd something I'd like to change.

To unsubscribe from this group, send email to reia+uns...@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/reia?hl=en.

Graeme Defty

unread,
Aug 29, 2010, 5:34:48 AM8/29/10
to re...@googlegroups.com
I confess I had to look up 'Poetry mode' when I read it in this thread (I have been out of touch with Ruby for a while, for various reasons). As far as I could make out from what I read, it seems to be mostly about

parse "string"

versus

parse("string")

the former being more poetic, apparently.

I assume from what I read here though that the term also applies to using words in preference to symbols for operators.

Personally, (as far as I recall - I did say it had been a while) I used && and || all the time and never bothered with 'and' and 'or'. The issue was not confusion - I always assumed I would get the precedence wrong anyway and used parentheses for disambiguation. No, I actually preferred && and || on aesthetic grounds. Yes, I know - exactly the opposite view, but that is how it is with aesthetics, no?  ;-)

If I were to try and dream up a post-justification for my preference, it would probably be to say that I want my operators to LOOK like operators. I am sure it does not take long to parse 'or' and 'and', but at first glance it is just a string of alphabetics, and I have to figure out what the word is and then decide it is a reserved word and NOT an identifier and THEN I am in a position to decide WHICH reserved words. Yes, I know, it doesn't take long but it must take up SOME brain cells, no? Well, ok, maybe not.

Perhaps more important than this, I think it is important to be clear on the goals for the language.

For example,

>  I think that's something I'd like to change.

sounds as though the language is intended as a vehicle to guide people to best practice (by some definition).  If that is the case then that would be a fine goal (depending on the definition of best practice, of course, and how closely it agreed with mine  ;-) ).

However, if the goal is to attract people to the language and the platform, each little point of differentiation from what they are familiar with is another potential reason why they may say "this is all to hard" and give up.

I am not suggesting that we should be slaves to the existing languages (and Ruby is the main danger, I guess, since that is the primary model for Reia) - after all we all progressed from presumably moderately sane languages to come to love the lunacy that is erlang! What I would suggest, though, is that there should be good reason for introducing a change.

In the end, it is your language, Tony, so it is your call. We are just here to help you make it happen.

Cheers,

g
______________________________________
Reply all
Reply to author
Forward
0 new messages