Can ruby replace c?

Hi
  Can ruby replace c ? Or no, because ruby is a high level language !!
  Can ruby write inline assembly?
  Does ruby have linker script, so i can link any piece to a specific
address, i need this often in driver programming.
  In c, if i declare char[100], it consume 100 bytes, if in ruby, does
it have a datatype that represent one byte? I heard everything in ruby
is object, no exception, so the answer should be no.
  Does ruby have pointer? a cpu-specific pointer? In 32 bit CPU,
pointer is 32 bits, in 16 bit CPU, pointer is 16 bits.

thanks
from Peter (cmk128@hotmail.com)

Perhaps when Matz and the team rewrite Ruby in Ruby.

If anybody could do that... it would be them. :wink:

-Robby

···

On Thu, 2005-10-06 at 12:11 +0900, cmk128@hotmail.com wrote:

Hi
  Can ruby replace c ? Or no, because ruby is a high level language !!

--
/******************************************************
* Robby Russell, Owner.Developer.Geek
* PLANET ARGON, Open Source Solutions & Web Hosting
* Portland, Oregon | p: 503.351.4730 | f: 815.642.4068
* www.planetargon.com | www.robbyonrails.com
* Programming Rails | www.programmingrails.com
*******************************************************/

cmk128@hotmail.com wrote:

Hi
  Can ruby replace c ? Or no, because ruby is a high level language !!
  Can ruby write inline assembly?

IIRC there is a project that allows incline C or assembly code. Someone
with more specific memory out there?

  Does ruby have linker script, so i can link any piece to a specific
address, i need this often in driver programming.

Well, you can write C extensions. And there you can do pretty much
everything C allows (if you respect some caveats, as mem allocation etc.).

  In c, if i declare char[100], it consume 100 bytes, if in ruby, does
it have a datatype that represent one byte? I heard everything in ruby
is object, no exception, so the answer should be no.

This is the closest you can get

s = "\000" * 100

  Does ruby have pointer? a cpu-specific pointer? In 32 bit CPU,
pointer is 32 bits, in 16 bit CPU, pointer is 16 bits.

No. And you don't need them and cannot use them in Ruby. You would have
to deal with this in an extension.

Kind regards

    robert

cmk128@hotmail.com wrote:

Can ruby replace c ?

irb(main):001:0> i = 0; "c".upto("ruby"){ i += 1 }; p i
330639

So there are quite a few iterations left before C will become Ruby (and,
given that D has been around for quite some time and hasn’t become even
close to finished, I’m guessing that the answer is “no”),
        nikolai

···

--
Nikolai Weibull: now available free of charge at http://bitwi.se/\!
Born in Chicago, IL USA; currently residing in Gothenburg, Sweden.
main(){printf(&linux["\021%six\012\0"],(linux)["have"]+"fun"-97);}

Ruby is an interpreted high level language. You can do a lot of C-like things
in Ruby, but due to performance reasons, Ruby won't replace C, at least until
we have an extremely efficient compiler. It is a perfect language for many
things however.

···

On Wednesday 05 October 2005 21:14, Robby Russell wrote:

On Thu, 2005-10-06 at 12:11 +0900, cmk128@hotmail.com wrote:
> Hi
> Can ruby replace c ? Or no, because ruby is a high level language !!

RubyInline - http://rubyforge.org/projects/rubyinline/

Linux only AFAIK (at least, it doesn't work for me on WinXP + VC7)

Regards,

Sean

···

On 10/6/05, Robert Klemme <bob.news@gmx.net> wrote:

IIRC there is a project that allows incline C or assembly code. Someone
with more specific memory out there?

En réponse à Nikolai Weibull :

Can ruby replace c ?

irb(main):001:0> i = 0; "c".upto("ruby"){ i += 1 }; p i
330639

So there are quite a few iterations left before C will become Ruby (and,
given that D has been around for quite some time and hasn’t become even
close to finished, I’m guessing that the answer is “no”),
        nikolai

This one really cracked me up! The first time I see a joke written in a programming language!!!

···

--
Christophe Grandsire.

http://rainbow.conlang.free.fr

You need a straight mind to invent a twisted conlang.

> IIRC there is a project that allows incline C or assembly code. Someone
> with more specific memory out there?

RubyInline - http://rubyforge.org/projects/rubyinline/

Linux only AFAIK (at least, it doesn't work for me on WinXP + VC7)

Windows is problematic since you'll need the compiler you built Ruby with
for the RubyInline stuff to work.

It's just fine on Mac's and other unix/linux boxen though.

···

On 10/6/05, Sean O'Halpin <sean.ohalpin@gmail.com> wrote:

On 10/6/05, Robert Klemme <bob.news@gmx.net> wrote:

Regards,

Sean

--
thanks,
-pate
-------------------------

Which D language?

The improvement to c++?

Or Sun's (very useful right now) dtrace language also called D?
http://docs.sun.com/app/docs/doc/817-6223

I am starting to wonder what languages will look like when we hit the
Z programming language. Theoretically it is all over then, I mean we
are out of letters unless we start using Greek or Russian or Japanese
characters.

Although would you really want to program in the beta language? Or
alpha for that matter?

Mitch

···

On 10/6/05, Christophe Grandsire <christophe.grandsire@free.fr> wrote:

En réponse à Nikolai Weibull :
>
>>Can ruby replace c ?
>
>
> irb(main):001:0> i = 0; "c".upto("ruby"){ i += 1 }; p i
> 330639
>
> So there are quite a few iterations left before C will become Ruby (and,
> given that D has been around for quite some time and hasn't become even
> close to finished, I'm guessing that the answer is "no"),
> nikolai
>

This one really cracked me up! The first time I see a joke written in a
programming language!!!
--
Christophe Grandsire.

http://rainbow.conlang.free.fr

You need a straight mind to invent a twisted conlang.

No, it should work on Windows too provided you built your own Ruby. You may need to set some ENV vars as well (like HOME or INLINE_DIR).

···

On Oct 6, 2005, at 3:10 AM, Sean O'Halpin wrote:

On 10/6/05, Robert Klemme <bob.news@gmx.net> wrote:

IIRC there is a project that allows incline C or assembly code. Someone
with more specific memory out there?

RubyInline - http://rubyforge.org/projects/rubyinline/

Linux only AFAIK (at least, it doesn't work for me on WinXP + VC7)

--
Eric Hodel - drbrain@segment7.net - http://segment7.net
FEC2 57F1 D465 EB15 5D6E 7C11 332A 551C 796C 9F04

Christophe Grandsire <christophe.grandsire@free.fr> writes:

En réponse à Nikolai Weibull :

Can ruby replace c ?

irb(main):001:0> i = 0; "c".upto("ruby"){ i += 1 }; p i
330639
So there are quite a few iterations left before C will become Ruby
(and,
given that D has been around for quite some time and hasn’t become even
close to finished, I’m guessing that the answer is “no”),
        nikolai

This one really cracked me up! The first time I see a joke written in
a programming language!!!

irb(main):002:0> "c".gsub!(/ruby/, "replacement")
=> nil

No, ruby can not replace c.

···

Christophe Grandsire.

--
Christian Neukirchen <chneukirchen@gmail.com> http://chneukirchen.org

'just fine' is an understatement though- this is a seriously under-rated
project!

cheers.

-a

···

On Fri, 7 Oct 2005, pat eyler wrote:

On 10/6/05, Sean O'Halpin <sean.ohalpin@gmail.com> wrote:

On 10/6/05, Robert Klemme <bob.news@gmx.net> wrote:

IIRC there is a project that allows incline C or assembly code. Someone
with more specific memory out there?

RubyInline - http://rubyforge.org/projects/rubyinline/

Linux only AFAIK (at least, it doesn't work for me on WinXP + VC7)

Windows is problematic since you'll need the compiler you built Ruby with
for the RubyInline stuff to work.

It's just fine on Mac's and other unix/linux boxen though.

--

email :: ara [dot] t [dot] howard [at] noaa [dot] gov
phone :: 303.497.6469
Your life dwells amoung the causes of death
Like a lamp standing in a strong breeze. --Nagarjuna

===============================================================================

Hi --

···

On Fri, 7 Oct 2005, Mitch wrote:

I am starting to wonder what languages will look like when we hit the
Z programming language. Theoretically it is all over then, I mean we
are out of letters unless we start using Greek or Russian or Japanese
characters.

   $ ruby -e 'p "Z".succ'
   "AA"

:slight_smile:

David

--
David A. Black
dblack@wobblini.net

I was wrong - it almost works with the One-Click Installer version. I
just didn't try hard enough.

The problem appears to be that it isn't picking up msvcrt-ruby18.lib
on the LINK step. It compiles when I copy the cl command line from the
error output and add the lib like so:

cl -nologo -LD -MD -Zi -O2b2xg- -G6 -I
c:/ruby/lib/ruby/1.8/i386-mswin32 -o Inline_MyTest_cb89.so
Inline_MyTest_cb89.c msvcrt-ruby18.lib -link /INCREMENTAL:no
/EXPORT:Init_Inline_MyTest_cb89

(with c:\ruby\lib added to the LIB environment variable) but how do I
get RubyInline to do this?

Any pointers anyone? (I'd love to play with this)

Sean

···

On 10/7/05, Eric Hodel <drbrain@segment7.net> wrote:

No, it should work on Windows too provided you built your own Ruby.
You may need to set some ENV vars as well (like HOME or INLINE_DIR).

Mitch wrote:

Which D language?

The improvement to c++?
D (programming language) - Wikipedia

Or Sun's (very useful right now) dtrace language also called D?
http://docs.sun.com/app/docs/doc/817-6223

I am starting to wonder what languages will look like when we hit the
Z programming language. Theoretically it is all over then, I mean we
are out of letters unless we start using Greek or Russian or Japanese
characters.

http://en.wikipedia.org/wiki/L_programming_language

http://en.wikipedia.org/wiki/Z_programming_language

Also...
A+ is an APL variant
P-code is an intermediate compilation language of Pascal
U is a game programming language (Untermud/UberMud)

AFAIK only H, I, N, O, V, W, X and Y left. So we're approach a crisis akin to IPv4. :wink:

Selon Mitch <idylls@gmail.com>:

I am starting to wonder what languages will look like when we hit the
Z programming language. Theoretically it is all over then, I mean we
are out of letters unless we start using Greek or Russian or Japanese
characters.

Some have already started with Hebrew letters:

(and http://en.wikipedia.org/wiki/Afnix_programming_language used to be called
Aleph)

:slight_smile:

Although would you really want to program in the beta language?

Some people would, it seems:

Or

alpha for that matter?

Can't find Alpha but Alphard exists:

Anyway, since we have Unicode we shouldn't feel limited to the Latin alphabet.
Let's make a language named after a Tibetan letter! :wink:

···

--
Christophe.

http://rainbow.conlang.free.fr

It takes a straight mind to create a twisted conlang.

Hi,

Although would you really want to program in the beta language?

Yes, it is actually very nice. If it were more widespread, I'd
probably still program in it. It has some nice syntactic sugar.

Patrick

Hello Mitch,

Which D language?

The improvement to c++?
D (programming language) - Wikipedia

Or Sun's (very useful right now) dtrace language also called D?
http://docs.sun.com/app/docs/doc/817-6223

I am starting to wonder what languages will look like when we hit the
Z programming language. Theoretically it is all over then, I mean we
are out of letters unless we start using Greek or Russian or Japanese
characters.

Z does exist but is a program specification language, a terrible thing
that you learn in university. Eiffel is a real language based on Z. So
we are just adding one or two more letters to the language name.

···

--
Best regards, emailto: scholz at scriptolutions dot com
Lothar Scholz http://www.ruby-ide.com
CTO Scriptolutions Ruby, PHP, Python IDE 's

Mitch <idylls@gmail.com> writes:

Which D language?

The improvement to c++?
D (programming language) - Wikipedia

Or Sun's (very useful right now) dtrace language also called D?
http://docs.sun.com/app/docs/doc/817-6223

I am starting to wonder what languages will look like when we hit the
Z programming language.

http://www.zuser.org/z/

Theoretically it is all over then, I mean we
are out of letters unless we start using Greek or Russian or Japanese
characters.

I think I've seen a language called "ya" already, which would be a
cyrillic letter...

Although would you really want to program in the beta language? Or
alpha for that matter?

Beta isn't that bad, but I prefer the Smalltalk-OO,
http://www.daimi.au.dk/~beta/

Alpha sounds more like assembler to me. :wink:

I guess we really need to switch over to spy-related themes for naming
programming languages. :slight_smile:

···

Mitch

--
Christian Neukirchen <chneukirchen@gmail.com> http://chneukirchen.org

The C builder has API to do this:

class X
   inline(:C) do |builder|
     builder.add_link_flags "whatever"
     # ...
   end
end

It is fairly well documented. Just generate the rdoc and poke around.

The better route to go is to build your own ruby and it'll pick up all the things it needs automatically.

Read rbconfig.rb for where we get all our building information.

···

On Oct 6, 2005, at 5:08 PM, Sean O'Halpin wrote:

On 10/7/05, Eric Hodel <drbrain@segment7.net> wrote:

No, it should work on Windows too provided you built your own Ruby.
You may need to set some ENV vars as well (like HOME or INLINE_DIR).

I was wrong - it almost works with the One-Click Installer version. I
just didn't try hard enough.

The problem appears to be that it isn't picking up msvcrt-ruby18.lib
on the LINK step. It compiles when I copy the cl command line from the
error output and add the lib like so:

cl -nologo -LD -MD -Zi -O2b2xg- -G6 -I
c:/ruby/lib/ruby/1.8/i386-mswin32 -o Inline_MyTest_cb89.so
Inline_MyTest_cb89.c msvcrt-ruby18.lib -link /INCREMENTAL:no
/EXPORT:Init_Inline_MyTest_cb89
(with c:\ruby\lib added to the LIB environment variable) but how do I
get RubyInline to do this?