[ruby-core:65057] [ruby-trunk - Feature #10214] [Closed] new functions for compare of symbols in C API

From: nobu@...
Date: 2014-09-16 05:08:57 UTC
List: ruby-core #65057
Issue #10214 has been updated by Nobuyoshi Nakada.

Description updated
Status changed from Feedback to Closed

----------------------------------------
Feature #10214: new functions for compare of symbols in C API
https://bugs.ruby-lang.org/issues/10214#change-48925

* Author: Hans Mackowiak
* Status: Closed
* Priority: Normal
* Assignee: 
* Category: core
* Target version: 
----------------------------------------
currently i often use Symbols as enums in my bindings, 
have something like this with comparing symbols by their ID

~~~C
if(SYMBOL_P(sym))
{
  if(rb_intern("name") == SYM2ID(sym))
    return ENUM_NAME;
}
~~~

now with dynamic symbols and other ones, its problematic because with that i always foce a dynamic symbol to become static or pinned (that what SYM2ID does)

so imo there need to be better ways to compare is an ID and a VALUE-sym or two VALUE-syms and check if they have the same content (hm because comparing two VALUE with == might/does not work) 



-- 
https://bugs.ruby-lang.org/

In This Thread

Prev Next