[#376274] Best Linux Distro for Ruby? — Nick Hird <boondox@...>

What are some of the better linux distro's for ruby development? I know

15 messages 2011/01/02

[#376329] Is singleton class of an object already created? — Samnang Chhun <samnang.chhun@...>

I would like to know is there any ways to check is singleton class of an

12 messages 2011/01/04

[#376333] Threading in ruby — "Vishnu I." <pathsny@...>

Hi

13 messages 2011/01/04
[#376335] Re: Threading in ruby — Robert Klemme <shortcutter@...> 2011/01/04

On Tue, Jan 4, 2011 at 8:41 AM, Vishnu I. <pathsny@gmail.com> wrote:

[#376339] ripl - an irb alternative - 0.3.0 released — ghorner <gabriel.horner@...>

ripl, a light modular alternative to irb, has reached 0.3.0. ripl

32 messages 2011/01/04

[#376382] Class Initialization? — Kedar Mhaswade <kedar.mhaswade@...>

I have a class and two class methods: self.encode and self.decode. The

14 messages 2011/01/05
[#376385] Re: Class Initialization? — Andrew Wagner <wagner.andrew@...> 2011/01/05

On Wed, Jan 5, 2011 at 9:33 AM, Kedar Mhaswade <kedar.mhaswade@gmail.com>wrote:

[#376388] Petition to add Metasploit Project as Ruby success story — Christian Kirsch <Christian_Kirsch@...7.com>

I noticed the Ruby success stories on the Ruby website. I would like to make a petition to list the open source Metasploit Project as a success story for the Ruby website. The Metasploit Project has seen more than a million unique downloads in the past 12 months and has over 700,000 lines of code, compared to 100,000 lines of the highly successful Ruby projects Puppet and Ruby on Rails.

10 messages 2011/01/05

[#376453] Block variable - How is it read in English? — SW Engineer <abder.rahman.ali@...>

Following the "Ruby on Rails Tutorial", and under section "6.1.1

16 messages 2011/01/06

[#376574] Best way for Array#find+transform ? — "Jonas Pfenniger (zimbatm)" <jonas@...>

There is a pattern that I'm using quite regularly, but I'm not

17 messages 2011/01/08
[#376575] Re: Best way for Array#find+transform ? — Anurag Priyam <anurag08priyam@...> 2011/01/08

> I know I can come up with a new method on Array that would shorten this to:

[#376576] Re: Best way for Array#find+transform ? — Anurag Priyam <anurag08priyam@...> 2011/01/08

> paths.map{|path| File.join(path, filename)}.select{|name| File.exist?(path)}

[#376577] Re: Best way for Array#find+transform ? — "Jonas Pfenniger (zimbatm)" <jonas@...> 2011/01/09

2011/1/8 Anurag Priyam <anurag08priyam@gmail.com>:

[#376579] Re: Best way for Array#find+transform ? — David J. Hamilton <groups@...> 2011/01/09

Excerpts from Jonas Pfenniger (zimbatm)'s message of Sat Jan 08 16:05:05 -0800 2011:

[#376586] Re: Best way for Array#find+transform ? — "Jonas Pfenniger (zimbatm)" <jonas@...> 2011/01/09

2011/1/9 David J. Hamilton <groups@hjdivad.com>:

[#376606] Re: Best way for Array#find+transform ? — David J. Hamilton <groups@...> 2011/01/10

Excerpts from Jonas Pfenniger (zimbatm)'s message of Sun Jan 09 04:08:10 -0800 2011:

[#376680] Parallel Assignments and Elegance/Complexity Ratio. — Kedar Mhaswade <kedar.mhaswade@...>

In SICP, I read that "Programs should be written for people to read, and

15 messages 2011/01/11
[#376697] Re: Parallel Assignments and Elegance/Complexity Ratio. — Josh Cheek <josh.cheek@...> 2011/01/11

On Tue, Jan 11, 2011 at 8:29 AM, Kedar Mhaswade <kedar.mhaswade@gmail.com>wrote:

[#376682] JRuby 1.6.0.RC1 released — Thomas E Enebo <tom.enebo@...>

The JRuby community is pleased to announce the release of JRuby 1.6.0.RC1.

14 messages 2011/01/11

[#376744] Case statements - Just beautification — flebber <flebber.crue@...>

I just want to clarify case statements the name after the word case is

10 messages 2011/01/12

[#376792] Ruby is interpreted and scripting language? — Sai Babu <sateesh.mca09@...>

I am ruby fresher.

16 messages 2011/01/13

[#376855] Retrieving and copying element from array — Simon Harrison <simon@...>

If I have an array like this:

11 messages 2011/01/13

[#376898] What are your ruby rough cuts ? — "Jonas Pfenniger (zimbatm)" <jonas@...>

Hi rubyists,

32 messages 2011/01/14
[#376930] Re: [poll] What are your ruby rough cuts ? — David Masover <ninja@...> 2011/01/15

On Friday, January 14, 2011 07:34:04 am Jonas Pfenniger (zimbatm) wrote:

[#376937] Re: What are your ruby rough cuts ? — Joseph Lenton <jl235@...> 2011/01/15

David Masover wrote in post #975080:

[#376959] Why Quby? (was Re: What are your ruby rough cuts ?) — David Masover <ninja@...> 2011/01/15

On Saturday, January 15, 2011 04:42:58 am Joseph Lenton wrote:

[#377020] Obscure syntax error — Rolf Timmermans <molfie@...>

Hi all,

16 messages 2011/01/17

[#377052] Calling by Reference - Two Questions — Mike Stephens <rubfor@...>

I know I'm not the first person to get stumped by how to get Ruby to

15 messages 2011/01/18

[#377072] The most recommended way of naming methods in Ruby — Edmond Kachale <edmond.kachale@...>

Rubists,

14 messages 2011/01/18
[#377082] Re: The most recommended way of naming methods in Ruby — Phillip Gawlowski <cmdjackryan@...> 2011/01/18

On Tue, Jan 18, 2011 at 9:16 AM, Edmond Kachale

[#377121] Improving performance of hash math — dblock <dblockdotorg@...>

I am trying to improve performance of Euclidian distance between two

13 messages 2011/01/19

[#377226] Totally lost in learning Ruby — Hilary Bailey <my77elephants@...>

This is my second attempt to understand Ruby. I completely read 1)

61 messages 2011/01/21
[#378239] Re: Totally lost in learning Ruby — Hilary Bailey <my77elephants@...> 2011/02/08

Hi everybody,

[#378246] Re: Totally lost in learning Ruby — Robert Klemme <shortcutter@...> 2011/02/08

On Tue, Feb 8, 2011 at 3:16 AM, Hilary Bailey <my77elephants@gmail.com> wrote:

[#377236] using gems installed via 'sudo gem install' — "Piotr S." <thisredoned@...>

I've installed ruby-opengl through sudo gem install because there were

15 messages 2011/01/21

[#377362] pg gem 0.10.1 wth Ruby 1.9.2 does not work with method @pg_conn.exec_prepared(stmt_name, parameters) — Zeno Davatz <zdavatz@...>

Hi

9 messages 2011/01/24

[#377388] The finer points of postfix conditionals. — Jon Leighton <j@...>

Hi,

13 messages 2011/01/24

[#377411] Obtain data from .csv — Kamarulnizam Rahim <niezam54@...>

Sample of .csv file:

19 messages 2011/01/25

[#377609] why is overloading invalid in ruby. — Ted Flethuseo <flethuseo@...>

I don't understand why when I try to overload I get an error. Can I

36 messages 2011/01/27

[#377645] If you had the choice between Ruby & Groovy — Noah Cutler <sit1way@...>

Hey All.

15 messages 2011/01/28

[#377650] IDE? — <johan.tempelman@...>

Hi,

13 messages 2011/01/28

[#377703] Zlib::GzipReader and multiple compressed blobs in a single stream — Jos Backus <jos@...>

Hi,

11 messages 2011/01/28

[#377761] New to programming AND new to Ruby — "Cassandra K." <cassandra.k@...>

Hello. I am trying to teach myself Ruby. I have no background in

13 messages 2011/01/31

[#377785] 2011: Which Ruby books have you read? And which would you recommend? — "Aston J." <azzzz@...>

I know there are a lot of threads about books, but some of them are as

16 messages 2011/01/31

[#377800] How to know the exit status within at_exit() block? — Iñaki Baz Castillo <ibc@...>

Hi, my program invokes "exit true" or "exit false" and I want to catch

17 messages 2011/01/31

Re: improvements on mixins

From: Joseph Lenton <jl235@...>
Date: 2011-01-14 00:13:29 UTC
List: ruby-talk #376875
> If you do that, it would be nice if you could register any number of
> callbacks with it, and they will all be run, so that you don't have to
> put
> all your after behaviour in one place, but can instead have lots of code
> receive notification of this method's completion.

This is how I want it to be too. So calling 'update' on a game object
might end up calling 10 different update functions that are all set to
be called around the original update method.

> I am curious what this
> method will receive, your example looked like it took parameters, how do
> you
> intend to pass parameters to it?

The parameters passed in are those passed to the method it's hanging
off. So if you call 'obj.foo( 5 )' then that 5 is also passed into the
'before' and 'after' methods in the imported module, before and after
foo is called on the class. One difference to Ruby is that my language
supports method overloading, so foo(a) and foo(a, b) can both exist in a
class and are entirely different methods.

> When I include a module, I would want to be able to pass it parameters,
> so
> the module could customize its methods for the class more intelligently.
> For
> example, if you want to use Ruby's Enumerable module, you must define
> #each.
> But what if you could name your iterator whatever you wanted? Well, to
> make
> that happen you have to jump through some counter-intutive hoops, like
> they
> do with Rails plugins. Okay, naming it something other than each isn't
> very
> useful, but think about things like Paperclip, where you can name your
> attachment whatever you want, and the methods it creates will be
> customized
> accordingly.

I think I fail to quite see what your after. But I do like the idea of
altering method signatures because it could make it easier to get
modules from different sources to match up. Like if one module appends
functionality on the 'update' method whilst another appends onto 'act'.
They don't match up and so you'd want to change say the 'act' to
'update'.

Building in the ability to allow modules to generate methods names based
on a parameter might end up looking like some funky Ruby-template
language; and be both too much work to build and use (especially for
most code).

As my language also allows you to define both 'foo(a)' and 'foo(a, b)'
in a class and module, you might also want to change the signature of a
modules method so again it matches up. Like: 'foo(a)'  to 'foo( a, _ )'
or 'foo( _, a )'.

But as you can reopen modules why not just do:

module Bar
    def act()
        update()
    end

    def foo( a, _ )
        foo( a )
    end
end

What might be nice is if you can apply it to any existing module without
that module needing to be aware that you are doing this. Something like:

class GameObject
    include AI {
        act() => update(),
        foo(a) => foo( a, _ )
    }
end

Then your restricting your changes to only affect it being mixed with
one class whilst not altering the module itself. That could be nice.

> I like that idea, but don't really see how it is an advantage over just
> having a class.

My thinking was that if you took my idea to the extreme then all your
code is built into modules. Classes then just become boiler plate for
mixing and setting up and initializing those modules. Having to write
boiler plate is a bad thing, so I'd like to find a way of avoid this.
But maybe this is leading to feature creep. Unless I can think of a more
natural way to mix modules, I'll skip this one.

> def asteroid
>   Object.new.instance_eval do
>     extend Drawable # here it would be nice to be able to say :image =>
> "images/asteroid.png"
>     extend MoveRandomly
>     extend DamagePlayer
>     self
>   end
> end

In regards to the 'extend Drawable' bit, an idea is to add constructors
for modules which the compiler can then force the user to initialize,
like:

module Drawable
    def new( img )
        @img = img
    end
end

class Asteroid
    import Drawable

    def new( img )
        Drawable.super( img )
    end
end

> Anyway, good luck with it, but I would consider what changes you want to
> make, and whether they really warrant creating an entirely new Ruby-like
> language, or if the similarities are strong enough that just using Ruby
> itself is satisfactory, ...

Thanks for all your suggestions. There are also some technical reasons
why I can't use Ruby itself. The main one is that it needs to run 100%
within the browser and your program then compiles to JavaScript. There
are some projects available already that allow you to run Ruby like
this, but most work by sending your code across to a server where it's
compiled and then sent back. Mine doesn't.

After I decided I had to make my own version I then thought I'd give in
and add lots of my own alterations that I'd like. null instead of nil,
'new' for constructors instead of 'initialize', C style comments, this
instead of self, function overloading instead of optional parameters,
and some static analysis and error checking during a compile time. I
used to program heavily in Java.

I'm also planning to add some type inference so you can only call
methods that might exist on the object your working with. With it being
less dynamic then standard Ruby, your program compiles directly to
JavaScript with very little runtime support needed. In theory your
program will run almost as fast as if you had written it in JavaScript.

-- 
Posted via http://www.ruby-forum.com/.

In This Thread