how???

H

Hunt Hunt

Hi friends,

I am a new ruby programmer. I have a question for all of you,

class ABC

end

As I read that Ruby is made in C. I checked the file class.c

There one structure is defined as RClass


struct RClass
{
struct RBasic basic;
struct st_table *iv_tbl
struct st_table *m_tbl;
Value super
}

when we defined a class in Ruby how does the things happen at
fundamental level.

???
how ABC is a class in RUBY?
 
K

Ken Burgett

[Note: parts of this message were removed to make it a legal post.]

I suggest you go the the Pragmatic Programmer's bookshelf and get the
Pickaxe book, Programming
Ruby<http://pragprog.com/titles/ruby/programming-ruby>.
This is a very good book, very readable. You will enjoy it.

2009/7/28 Hunt Hunt said:
Hi friends,

I am a new ruby programmer. I have a question for all of you,

class ABC

end

As I read that Ruby is made in C. I checked the file class.c

There one structure is defined as RClass


struct RClass
{
struct RBasic basic;
struct st_table *iv_tbl
struct st_table *m_tbl;
Value super
}

when we defined a class in Ruby how does the things happen at
fundamental level.

???
how ABC is a class in RUBY?


--
Regards,

Ken

Seek wisdom through disbelief
 
K

Kyle Smith

Hi friends,

I am a new ruby programmer. I have a question for all of you,

class ABC

end

As I read that Ruby is made in C. I checked the file class.c

There one structure is defined as RClass


struct RClass
{
struct RBasic basic;
struct st_table *iv_tbl
struct st_table *m_tbl;
Value super
}

when we defined a class in Ruby how does the things happen at
fundamental level.

???
how ABC is a class in RUBY?

Because you defined it as a class when you said:
def ABC
end

Why does it matter how it is turned into a class in C? It has been defined
as a class, by you, in Ruby and thus is a class.
 
P

pharrington

Because you defined it as a class when you said:
def ABC
end

Why does it matter how it is turned into a class in C?  It has been defined
as a class, by you, in Ruby and thus is a class.

Eigenclass has a guide outline for teaching yourself the "basics" of
Ruby at http://eigenclass.org/hiki.rb?ruby+internals+guide. Also just
googling today I found this presentation http://mtnwestrubyconf2008.confreaks.com/11farley.html
from MontainWest Ruby last year, which really makes Ruby's internal
handling of class hierarchies and method dispatching clear.
 
B

Brian Candler

Hunt said:
when we defined a class in Ruby how does the things happen at
fundamental level.

There's some stuff on interfacing Ruby internals with C at
http://www.ruby-doc.org/docs/ProgrammingRuby/html/ext_ruby.html

An object reference is a VALUE. Most people don't have to worry about
how a Class might be different from any other type of Object internally.
If you do, the source code is all there... it's probably just not the
right place to start :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,169
Messages
2,570,920
Members
47,464
Latest member
Bobbylenly

Latest Threads

Top