Issue #13125 has been updated by Shyouhei Urabe.


We looked at this issue at yesterday's developer meeting.  Nobody was against introducing a macro.  No consensus over its name was made though.

- RBOOL() seems like a member of RSTRING(), RARRAY() and family so not very good.
- It is in fact a INT2FIX()'s family so I proposed BOOL2BOOL() but this sounds too strange.
- What is needed is a "reverse" of RTEST() so RUNTEST() is proposed (I believe it was not serious).

----------------------------------------
Bug #13125: MRI has too much Qtrue : Qfalse;
https://bugs.ruby-lang.org/issues/13125#change-62604

* Author: Shyouhei Urabe
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 
* ruby -v: 
* Backport: 2.2: UNKNOWN, 2.3: UNKNOWN, 2.4: UNKNOWN
----------------------------------------
```
% git grep -P 'Q(true|false|nil|undef)\s+:\s+Q(true|false|nil|undef)' | wc -l
211
```

Out of those 211 occurrences the most interesting lines include:

```
complex.c:#define f_boolcast(x) ((x) ? Qtrue : Qfalse)
math.c:#define f_boolcast(x) ((x) ? Qtrue : Qfalse)
range.c:#define RBOOL(v) ((v) ? Qtrue : Qfalse)
rational.c:#define f_boolcast(x) ((x) ? Qtrue : Qfalse)
```

I strongly believe that we need an orthodox way to do this.



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

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>