[#3907] Obtaining mode information on an IO object — Jos Backus <jos@...>

The attached patch implements IO#mode. This method returns the mode the IO

17 messages 2004/12/06
[#3909] Re: [patch] Obtaining mode information on an IO object — nobu.nokada@... 2004/12/07

Hi,

[#3910] Re: [patch] Obtaining mode information on an IO object — Jos Backus <jos@...> 2004/12/07

On Tue, Dec 07, 2004 at 09:25:13AM +0900, nobu.nokada@softhome.net wrote:

[#3925] Re: [patch] Obtaining mode information on an IO object — James Britt <ruby@...> 2004/12/09

Jos Backus wrote:

[#4009] cgi.rb -- more GET/POST stuff — mde@...26.com

First of all, I think it would be great, as Eustaquio suggests, to

17 messages 2004/12/23
[#4016] Re: [PATCH] cgi.rb -- more GET/POST stuff — Francis Hwang <sera@...> 2004/12/24

GETs and POSTs are defined to be fairly different actions. I'd read

[#4027] Allowing custom number literal suffixes? — Florian Gro<florgro@...>

Moin!

35 messages 2004/12/27
[#4070] Re: Allowing custom number literal suffixes? — nobu.nokada@... 2005/01/02

Hi,

[#4072] Re: Allowing custom number literal suffixes? — Mathieu Bouchard <matju@...> 2005/01/02

[#4079] Re: Allowing custom number literal suffixes? — Florian Gro<florgro@...> 2005/01/03

Mathieu Bouchard wrote:

[#4081] Re: Allowing custom number literal suffixes? — Mathieu Bouchard <matju@...> 2005/01/03

[#4082] Re: Allowing custom number literal suffixes? — Florian Gro<florgro@...> 2005/01/03

Mathieu Bouchard wrote:

[#4084] Re: Allowing custom number literal suffixes? — Brent Roman <brent@...> 2005/01/04

I'm not sure I would advocate making Ruby's grammar even more

[#4086] Re: Allowing custom number literal suffixes? — Mathieu Bouchard <matju@...> 2005/01/04

[#4033] Garbage collection trouble — Christian Neukirchen <chneukirchen@...>

Hello,

13 messages 2004/12/27

Re: Extensions, Internal

From: Jgen Mangler <juergen.mangler@...>
Date: 2004-12-28 08:06:57 UTC
List: ruby-core #4042
myObj.text.gsub!(/a/,"b") will not alter the string returned by #text, 
because it returns a duplicated value from inside an extension. Sorry i 
can't explain it better.

think of something like:

VALUE rbxs_node_text_get(VALUE self) {
   rbxs_node *prbxs;

   Data_Get_Struct(self, rbxs, prbxs);
 
return(rb_str_new2(CONVERT_FROM_SOME_STRING_FORMAT(prbxs->node->content)));
}

VALUE rbxs_node_text_set(VALUE self, VALUE text) {
   rbxs_node *prbxs;

   Data_Get_Struct(self, rbxs, prbxs);

   setSomeStrangeTextFormat(prbxs->node->content,STR2CSTR(text));
}

when calling #gsub! on something that rbxs_node_text_get returns, it 
just don't alters the object it is called on, because it can't. Content 
can only be set through setSomeStrangeTextFormat

Maybe i missed something important, but after discussing a bit on 
#ruby-lang, someone came up with

"you could also create a wrapper string which has .gsub! and so on 
replaced with special versions that go through the setter"

which seemed somehow ... uncool to me.

I though that maybe I can tell a string, what to call to deliver 
something back (in this case rbxs_node_text_set). A callback function.
(Described in the first detail)

Sorry for my bad english.

Jgen

Yukihiro Matsumoto wrote:
> Hi,
> 
> In message "Re: Extensions, Internal"
>     on Tue, 28 Dec 2004 14:54:50 +0900, Jgen Mangler <juergen.mangler@univie.ac.at> writes:
> 
> |rb_define_method(cSimpleNode, "text",    rbxs_node_text_get, 0);
> |rb_define_method(cSimpleNode, "text=",   rbxs_node_text_set, 1);
> |
> |I've to return duplicates of the string, because the string format is 
> |incompatible/the string can only be set by calling a function. So a 
> |gsub! will not work as expected.
> 
> I'm afraid I don't understand what you want.  What do you expect for a
> gsub! to work?
> 
> 							matz.
> 
> 


In This Thread