Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > Ruby could be wildly more popular if it had ...

Reply
Thread Tools

Ruby could be wildly more popular if it had ...

 
 
Chris Thomas
Guest
Posts: n/a
 
      08-01-2003

On Thursday, July 31, 2003, at 5:40 PM, Gavin Sinclair wrote:

>>>
>>> But then you get some larger ones:
>>>
>>> set.map { |e|
>>> if something
>>> e.x
>>> else
>>> e.y
>>> end
>>> }

>>
>> [Robert:]
>> Know your ternary operator:
>> set.map { |e| something ? e.x : e.y }

>
>
> I know my ternary operator, but:
> - in my code snippet, "something", "e.x", and "e.y" were placeholders
> for something far bigger than you or I could imagine
> - sometimes there is multi-part processing do be done before arriving
> the "return value" for the block


Also
- The ternary operator is idiomatic of expert (or expert-wannabe) use
of the C family of languages and likely to confuse and even scare away
novice Ruby users who aren't from that segment of the population, or
only have limited experience with C.

Chris


 
Reply With Quote
 
 
 
 
Robert Klemme
Guest
Posts: n/a
 
      08-01-2003

"Chris Thomas" <(E-Mail Removed)> schrieb im Newsbeitrag
news:(E-Mail Removed)...
> Also
> - The ternary operator is idiomatic of expert (or expert-wannabe) use
> of the C family of languages and likely to confuse and even scare away
> novice Ruby users who aren't from that segment of the population, or
> only have limited experience with C.


That's possibly true. I faintly remember the times when I first saw ?:
and wondered what that might be. Nowadays I've become so acquainted with
this idom that I hardly notice this as something strange. Thanks for
reminding me!

Regards

robert

 
Reply With Quote
 
 
 
 
Marko Schulz
Guest
Posts: n/a
 
      08-01-2003
On Fri, Aug 01, 2003 at 07:48:54PM +0900, Martin DeMello wrote:
>
> The ternary operator is *useful*, as evidenced by the fact that people
> use it when equivalents exist.


???
Violence is *useful*, as evidenced by the fact that people
use it when equivalents exist.
???

--
marko schulz

 
Reply With Quote
 
Xiangrong Fang
Guest
Posts: n/a
 
      08-01-2003
The beauty of ruby is its tolerance. I use delphi heavily, also Java
Javascript and C. Everything works fine in Ruby. No surprise at all.

Ruby is pragmatic programming language. Don't even think about grammar.

If you hate ternary, simply don't use it.


On Fri, 1 Aug 2003 19:51:31 +0900
Marko Schulz <(E-Mail Removed)-hamburg.de> wrote:

> On Fri, Aug 01, 2003 at 07:48:54PM +0900, Martin DeMello wrote:
> >
> > The ternary operator is *useful*, as evidenced by the fact that people
> > use it when equivalents exist.

>
> ???
> Violence is *useful*, as evidenced by the fact that people
> use it when equivalents exist.
> ???
>
> --
> marko schulz


--
Xiangrong Fang <(E-Mail Removed)>



 
Reply With Quote
 
Josef 'Jupp' Schugt
Guest
Posts: n/a
 
      08-01-2003
Saluton!

* Marko Schulz; 2003-08-01, 12:37 UTC:
> On Fri, Aug 01, 2003 at 07:48:54PM +0900, Martin DeMello wrote:
> >
> > The ternary operator is *useful*, as evidenced by the fact that people
> > use it when equivalents exist.

>
> ???
> Violence is *useful*, as evidenced by the fact that people
> use it when equivalents exist.
> ???


Correct. The question is if being useful makes it acceptable. Some
people believe that a goal can justify any means while others believe
that this is not true.

I am pretty sure that there is an equivalent of German 'Der Zweck
heiligt die Mittel' in many languages...

Gis,

Josef 'Jupp' Schugt
--
N'attribuez jamais à la malice ce que l'incompétence explique !
-- Napoléon

 
Reply With Quote
 
Josef 'Jupp' Schugt
Guest
Posts: n/a
 
      08-02-2003
Saluton!

* Austin Ziegler; 2003-08-02, 21:17 UTC:
> >> Violence is *useful*, as evidenced by the fact that people use it when
> >> equivalents exist. ???

> > Correct. The question is if being useful makes it acceptable. Some people
> > believe that a goal can justify any means while others believe that this
> > is not true.
> >
> > I am pretty sure that there is an equivalent of German 'Der Zweck heiligt
> > die Mittel' in many languages...

>
> "The End Justifies the Means", in English.
>
> I disagree with it, believing that the means can corrupt the end.


Obviously even the UN Security Council does not share your (and mine)
opinion. They guarantee that a well-known country's troops may commit
any crime of war without being punished for it by the international
community. I don't think that they are going to commit such crimes
but that does not change the ethical implications of the decision.

Gis,

Josef 'Jupp' Schugt
--
N'attribuez jamais à la malice ce que l'incompétence explique !
-- Napoléon

 
Reply With Quote
 
Michael Garriss
Guest
Posts: n/a
 
      08-02-2003
Could you take this discussion off the list please.

Josef 'Jupp' Schugt wrote:

>Saluton!
>
>* Austin Ziegler; 2003-08-02, 21:17 UTC:
>
>
>>>>Violence is *useful*, as evidenced by the fact that people use it when
>>>>equivalents exist. ???
>>>>
>>>>
>>>Correct. The question is if being useful makes it acceptable. Some people
>>>believe that a goal can justify any means while others believe that this
>>>is not true.
>>>
>>>I am pretty sure that there is an equivalent of German 'Der Zweck heiligt
>>>die Mittel' in many languages...
>>>
>>>

>>"The End Justifies the Means", in English.
>>
>>I disagree with it, believing that the means can corrupt the end.
>>
>>

>
>Obviously even the UN Security Council does not share your (and mine)
>opinion. They guarantee that a well-known country's troops may commit
>any crime of war without being punished for it by the international
>community. I don't think that they are going to commit such crimes
>but that does not change the ethical implications of the decision.
>
>Gis,
>
>Josef 'Jupp' Schugt
>
>




 
Reply With Quote
 
Josef 'Jupp' Schugt
Guest
Posts: n/a
 
      08-03-2003
Saluton!

* Michael Garriss; 2003-08-03, 17:39 UTC:
> Could you take this discussion off the list please.


Sorry ... I just wanted to point out that different opinions exist
even on that subject.

As far as the use of parentheses in Ruby are concerned I don't see a
necessity to add more of them to Ruby's syntax. If one really wants
to use lots of them this is already possible, if one wants to avoid
them as far as possible this is also feasible. One should note that
one can easily avoid parentheses in C by means of two almost trivial
preprocessor defines:

#define begin {
#define end }

int main(int argc, char **argv)
begin
if (argc < 2)
begin
return -1;
end
else
begin
return argc-1;
end
end

The result is some new programming language - it's no longer C (one
should keep in mind that C++ started as C preprocessor macros).

Adding new parentheses to Ruby would result in something similar:
'Ruby--'

Gis,

Josef 'Jupp' Schugt
--
N'attribuez jamais à la malice ce que l'incompétence explique !
-- Napoléon

 
Reply With Quote
 
Brian Candler
Guest
Posts: n/a
 
      08-03-2003
On Mon, Aug 04, 2003 at 07:01:33AM +0900, Josef 'Jupp' Schugt wrote:
> One should note that
> one can easily avoid parentheses in C by means of two almost trivial
> preprocessor defines:
>
> #define begin {
> #define end }


But then they are just 3-5 character parentheses, not 1-character
parentheses...

>
> int main(int argc, char **argv)
> begin
> if (argc < 2)
> begin
> return -1;
> end
> else
> begin
> return argc-1;
> end
> end


Actually all those apart from the first 'begin' and the final 'end' are not
necessary in C.

Cheers,

Brian.

 
Reply With Quote
 
Robert Klemme
Guest
Posts: n/a
 
      08-04-2003

"Josef 'Jupp' Schugt" <(E-Mail Removed)> schrieb im Newsbeitrag
news:20030803185615.GA569@jupp%gmx.de...
> #define begin {
> #define end }
>
> int main(int argc, char **argv)
> begin
> if (argc < 2)
> begin
> return -1;
> end
> else
> begin
> return argc-1;
> end
> end


int main(int argc, char **argv) {
return argc < 2 ? -1 : argc-1;
}

(I love that ternary operator... )

> The result is some new programming language - it's no longer C (one
> should keep in mind that C++ started as C preprocessor macros).


Not 100% correct, AFAIK. C++ started out as a precompiler that spat out C
code. CPP macros are by far not powerful enough to implement C++ on top
of C. Just think of the management of inheritance hierarchies.

Regards

robert

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Hosting - wildly different response times across the globe badger_nz ASP .Net 1 12-12-2006 04:00 AM
CPU Usage % spikes wildly; system slow overall (IBM T20 laptop, 512 MB RAM) Larry Mehl Computer Support 6 07-07-2006 11:13 PM
Re: Wildly OT:My spampot experiment Robert Moir MCSE 1 05-25-2005 08:46 PM
Re: Wildly OT:My spampot experiment JaR MCSE 1 05-25-2005 07:29 PM
Wildly uneven volume on some DVDs mexican_equivalent@yahoo.com DVD Video 12 04-20-2005 08:26 AM



Advertisments