Re: What's wrong the __autoload()?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



2008. 03. 12, szerda keltezéssel 13.27-kor Greg Donald ezt írta:
> On 3/12/08, Zoltán Németh <znemeth@xxxxxxxxxxxxxx> wrote:
> > ok, I admit I don't have experience with Ruby but I have experience with
> >  php. and I don't have experience with Ruby because I read some manuals
> >  and example codes and whatnot and I just could not get to like it at
> >  all.
> 
> That's a lot different from your previous blanket statement of "Ruby
> as a language just plain sucks".  I hate you less now that I know a
> bit more about you, see how that works?

didn't you notice the smiley at the end of that line? that was not a
serious plain statement but some mocking at you because you made a plain
statement about RoR being better.

> 
> > it's just so strange and different from anything I know (php, c,
> >  java) -
> 
> Ruby has a lot of functional language influence.  Once you use it you
> really start to like how much shorter your iterative loops are for
> example.  The first two developers I worked with using Ruby also knew
> ML and Scheme.  One of them suggested I go study Scheme so I would
> appreciate Ruby more.  I did so for several weeks and now I do.  Ruby
> provides everything from the procedural world we're currently used to
> seeing in PHP, C, and Java, but it also adds functional style that
> makes for some utterly beautiful, compact code.

'utterly beautiful' is again a matter of taste :)
of course, I admit that Ruby would provide me all the features I
currently use, it has to, otherwise noone would start using it instead
of their current language. and yes, I see from the examples that it is
shorter. but is shortness/compactness such a great advantage? I'm not at
all sure about that.

> 
> > and I could not find out any good reasons for most of the
> >  differences...
> 
> And you won't until you use it in practice more than once.  But that's
> true of most any language.  I worked in Python by day for the better
> part of last year and man was it fun seeing other ideas for how to do
> things.

that might be true, but in the last year I've been working on the same
big project, and it seems I will be working on it for this year too, you
know, next versions and such, so at this moment I don't have serious
amount of time to experiment with anything. in fact, I'm also a bit
workaholic and also I'm attending some evening university so I hardly
have time to read a manual completely...

> 
> > e.g. how come function definitions are between 'def' and
> >  'end'?
> 
> def is shorter than PHP's "function" qualifier?  I give up.  'end' is
> optionally replacable with '}',  as is 'do' and '{' but you probably
> didn't ever get to that page in the Ruby book you read.

as I said above, I had/have not much time, so my reading might have been
sloppy... and is shortness that important?

> 
> > I just don't like it and it's a matter of taste,
> 
> In my experience "matter of taste" usually equates to "resistance to
> learning", but call it what you will.

well, there is difference between that. its like if you have a very
limited time frame you can spend on learning, you choose to learn more
of something you like already, no? sure, if I had more time, I would
experiment more with things I don't like or I don't know really.

> 
> > so there is no
> >  need to argue about it more... :)
> 
> There's always reason to argue the features of a given language.  For
> example you may need to try and convince me at some point that Zombie
> is a great language:
> 
> http://www.dangermouse.net/esoteric/zombie.html
> 
> Or not.



> 
> >  however that's not about the framework, I admit that Rails had several
> >  new and useful concepts, and I know that the framework I currently use
> >  took a lot of ideas from there.
> 
> Those other frameworks can never be as powerful as Rails because they
> aren't written in something as meta-capable as Ruby.  Can you do this
> in PHP?
> 
> class Foo
> end
> 
> f = Foo.new
> 
> class Foo
>   Resource.find( :all ).each do |r|
>     res = r.name.downcase
>     define_method( "op_cost_#{ res }".to_sym ) do
>       self.properties.inject( 0 ){ |c,p| c + p.send( "op_cost_#{ res }" ) }
>     end
>   end
> end
> 
> cost = f.op_cost_wheat
> 
> No you can't.  PHP doesn't support adding methods to classes at
> runtime, nor does it support adding methods to instantiated objects of
> those classes at runtime.  And that's just one example.  These sort of
> OO advantages exist throughout Ruby.
> 
> You don't love these features because you don't know they exist.  You
> don't know they exist because you haven't given the language more than
> a few minutes of your time.  Running through some silly little 5
> minute Rails scaffolding tutorial will in no way teach you the real
> power that exists in Ruby.

hmm that feature looks interesting, however I can't really think of a
case where I would want to modify the class definition of an
instantiated object.... maybe later, when I'll have some more time I
give Ruby a second run, and we'll see what comes out of that.

greets,
Zoltán Németh

> 
> 
> -- 
> Greg Donald
> http://destiney.com/
> 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux