Skip to content

Commit 0e6b32b

Browse files
authored
Merge pull request #70 from mruby-Forum/release-mruby-2.1.0
mruby 2.1.0 released.
2 parents 039ec91 + 9d0c68d commit 0e6b32b

File tree

1 file changed

+259
-0
lines changed

1 file changed

+259
-0
lines changed
Lines changed: 259 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,259 @@
1+
---
2+
layout: post
3+
title: "mruby 2.1.0 released"
4+
date: 2019-11-19 00:00:00
5+
categories: releases
6+
---
7+
8+
# mruby 2.1.0
9+
10+
We are proudly announcing the stable release of mruby 2.0 series - [mruby 2.1.0](https://github.com/mruby/mruby/releases/tag/2.1.0).
11+
The [mruby 2.1.0](https://github.com/mruby/mruby/releases/tag/2.1.0) has been enhanced with compatibility with Ruby 2 series, and some new features of Ruby 2.7 have been added.
12+
13+
---
14+
15+
# New Features
16+
17+
## Core Language Features
18+
19+
- Suffix support (`Rational` and `Complex` literals) (#4125)
20+
21+
## Core Libraries
22+
23+
### Ruby 2.7 features
24+
25+
- Add `Array#intersection` method which returns a new array containing elements common to both arrays. (mrbgems/mruby-array-ext)
26+
- Add `Enumerable#filter_map` method which is a short hand for `filter` + `map` in a single call. (mrbgems/mruby-enum-ext)
27+
- Add `Enumerable#tally` method which group and count elements of the collection. (mrbgems/mruby-enum-ext)
28+
- Add `Enumerator.produce` method which creates an infinite enumerator from any block. (mrbgems/mruby-enumerator)
29+
- Add `UnboundMethod#bind_call` method which call a method that overridden without allocation of intermediate Method object. (mruby-method)
30+
- `Module#name`, `true#to_s`, `false#to_s` return a frozen string. The returned string is always the same object.
31+
32+
### Ruby 2.6 features
33+
34+
- Add `Array#difference` method:
35+
`Array#difference` returns a new array that is a copy of the original array, removing any items that also appear in other_ary. (mrbgems/mruby-array-ext)
36+
37+
### New Libraries
38+
39+
- Add `mrbgems/mruby-rational`:
40+
[dyama/mruby-rational](https://github.com/dyama/mruby-rational) has been included into the core library, and rational numbers like `1/3` can be handled.
41+
- Add `mrbgems/mruby-complex`:
42+
[pbosetti/mruby-complex](https://github.com/pbosetti/mruby-complex) has been included into the core library to handle complex numbers.
43+
44+
### New C APIs
45+
46+
#### Macros for checking object type
47+
48+
```c
49+
mrb_false_p(o)
50+
mrb_true_p(o)
51+
mrb_free_p(o)
52+
mrb_object_p(o)
53+
mrb_class_p(o)
54+
mrb_module_p(o)
55+
mrb_iclass_p(o)
56+
mrb_sclass_p(o)
57+
mrb_proc_p(o)
58+
mrb_range_p(o)
59+
mrb_file_p(o)
60+
mrb_env_p(o)
61+
mrb_data_p(o)
62+
mrb_fiber_p(o)
63+
mrb_istruct_p(o)
64+
mrb_break_p(o)
65+
```
66+
67+
#### mruby core (mruby.h)
68+
69+
```c
70+
MRB_API mrb_int mrb_cmp(mrb_state *mrb, mrb_value obj1, mrb_value obj2);
71+
```
72+
73+
#### mruby binary (mruby/dump.h, mruby/irep.h)
74+
75+
```c
76+
MRB_API mrb_irep *mrb_read_irep_buf(mrb_state*, const void*, size_t); // mruby/dump.h
77+
MRB_API mrb_value mrb_load_irep_buf(mrb_state*, const void*, size_t); // mruby/irep.h
78+
MRB_API mrb_value mrb_load_irep_buf_cxt(mrb_state*, const void*, size_t, mrbc_context*); // mruby/irep.h
79+
```
80+
81+
#### Numeric class (mruby/numeric.h)
82+
83+
```c
84+
MRB_API mrb_value mrb_num_plus(mrb_state *mrb, mrb_value x, mrb_value y);
85+
MRB_API mrb_value mrb_num_minus(mrb_state *mrb, mrb_value x, mrb_value y);
86+
MRB_API mrb_value mrb_num_mul(mrb_state *mrb, mrb_value x, mrb_value y);
87+
MRB_API mrb_value mrb_int_value(mrb_state *mrb, mrb_float f);
88+
```
89+
90+
#### String class (mruby/string.h)
91+
92+
```c
93+
MRB_API void mrb_str_modify_keep_ascii(mrb_state *mrb, struct RString *s);
94+
MRB_API const char *mrb_string_cstr(mrb_state *mrb, mrb_value str);
95+
```
96+
97+
#### mruby/value.h
98+
99+
- Add customized `mrb_ro_data_p()` (#4408)
100+
101+
#### Enumerable module and Hash class
102+
103+
- Add `filter` aliases for `Enumerable` and `Hash`. (57a0132b)
104+
105+
## Configuration
106+
107+
- (Proof of Concept) mruby tuning profiles (#4446)
108+
109+
## mrbtest
110+
111+
### Test Features
112+
113+
- Warn if assertion is missing inside `assert` (#4320)
114+
115+
### New test method (mrbtest)
116+
117+
```ruby
118+
assert_match(pattern, str, msg=nil)
119+
assert_not_match(pattern, str, msg=nil)
120+
assert_raise_with_message(exc, exp_msg, msg = nil, &block
121+
assert_raise_with_message_pattern(exc, exp_msg, msg = nil, &block)
122+
assert_not_nil(target, msg)
123+
```
124+
125+
## Tools
126+
127+
### Interactive mruby (mirb)
128+
129+
- As with `irb` in Ruby, a local variable `_` is added to store the last result.
130+
131+
---
132+
# Update Features
133+
134+
## mruby core
135+
136+
- Allow newlines and comments between method calls. (4296c77e)
137+
- Support `&.` at the beginning of the line (4124047c)
138+
139+
## Build system
140+
141+
- Support lock file
142+
It is now possible to fix mruby and mrbgems versions in products that use mruby.
143+
- Rename MRB_USE_ETEXT_EDATA to MRB_USE_LINK_TIME_RO_DATA_P and support lld linked programs (#4716)
144+
145+
## C APIs
146+
147+
### mruby core
148+
149+
- Keyword arguments can be obtained with `mrb_get_args` using the format string `:`.
150+
- `mrb_parser_dump` supports displaying `NODE_DSYM`, `NODE_WORDS`, `NODE_SYMBOLS` and `NODE_LITERAL_DELIM`.
151+
- Raise `ArgumentError` by `aspec` check. (30f37872)
152+
153+
### src/error.c
154+
155+
- Add new specifiers/modifiers to format string of `mrb_vfromat()` (#4608)
156+
157+
## mrbtest
158+
159+
- Nested `assert` for mrbtest (#4540)
160+
161+
---
162+
# Compatibility
163+
164+
## mruby core
165+
166+
- Pad leading zero to month and day in `MRUBY_RELEASE_DATE` (#4353)
167+
168+
## Core Libraries
169+
170+
- Add `Class#new(*args, &block)` method.
171+
- Add optional argument to `Module#class_variables`.
172+
- Add constants for floating point number. (`RADIX`, `MANT_DIG`, `EPSILON`, `DIG`, `MIN_EXP`, `MIN`, `MIN_10_EXP`, `MAX_EXP`, `MAX`, `MAX_10_EXP`)
173+
- Removed `$1`..`$9` from `Kernel#global_variables`.
174+
- String#unpack/Array#pack does support base64 directive (`m`).
175+
- Add encoding argument to `Integral#chr` (#4593)
176+
- Fixed `length` for IO should be in bytes, not in characters (8c90b5fc)
177+
178+
---
179+
# Breaking Changes
180+
181+
There are three major breaking changes from mruby 2.0.1.
182+
183+
## Changed methods
184+
185+
- Move `Array#append` and `Array#prepend` from core to `mrbgems/mruby-ary-ext`.
186+
- Move `Numeric#div` from `mrbgems/mruby-numeric-ext` to the core.
187+
- Move `Integral#zero?`, `Integral#nonzero?`, `Integral#positive?` and `Integral#negative)?` to `Numeric` class.
188+
- Move `Numeric#__coerce_step_counter` to `Integral` class.
189+
- Move `Kernel#instance_exec`, `Kernel#equal?` and `Kernel#instance_eval` to `BasicObject` class.
190+
- Move `NilClass#to_h` to `mrbgems/mruby-object-ext` from `mrbgems/mruby-enum-ext`
191+
- Move `String#getbyte`, `String#setbyte` and `String#byteslice` to the core. (#4696)
192+
- Remove `Kernel#global_variables` from core. This method is defined in `mrbgems/mruby-metaprog`.
193+
- Integrate `Integral#chr` (`Fixnum#chr`) to `mrbgems/mruby-string-ext`.
194+
- Remove `String#=~` and `String#match` that requires `Regexp` (fd37bc53)
195+
- `Symbol#to_s` return a frozen string. The returned string is always the same object. This feature will be reverted next mruby, because which reverted from Ruby 2.7.
196+
- Explicit `.0` is removed from result of `Float#to_s` and `Float#inspect`. (9d08025b)
197+
198+
## Change C APIs
199+
200+
- Rename symbol-to-string functions. (#4684)
201+
- `mrb_sym2name()` -> `mrb_sym_name()`
202+
- `mrb_sym2name_len()` -> `mrb_sym_name_len()`
203+
- `mrb_sym2str()` -> `mrb_sym_str()`
204+
205+
## Remove C APIs
206+
207+
- Functions to remove `MRB_API` from definitions (referenced from within `libmruby`):
208+
`mrb_instance_new()`, `mrb_vm_define_class()`, `mrb_vm_define_module()`
209+
- `struct RIstruct` is renamed to `struct RIStruct` (e41f1574)
210+
* Remove `mrb_fixnum_plus()`, `mrb_fixnum_minus()`, `mrb_fixnum_mul()`, and `mrb_num_div()`. Use `mrb_num_plus()`, `mrb_num_minus()`, `mrb_num_mul()` instead.
211+
- Remove a member `ary` of `struct RString`. `struct RStringEmbed` is used for String embedding. (#4646)
212+
213+
## mruby core
214+
215+
- Remove global variable `$/`. The current Ruby policy do not encourage Perl-ish global variables.
216+
- Remove `MRB_TT_HAS_BASIC` macro. (#4728)
217+
- Remove members `flags` and `mems` of `struct mrb_state`. (0c5f26e0 and #4470)
218+
219+
## Configuration
220+
221+
- Remove `MRB_METHOD_TABLE_INLINE` and `MRB_NO_INIT_ARRAY_START`. (2256bb07 and #4716)
222+
- `MRB_USE_ETEXT_EDATA` is deprecated (warned and ignored). instead, use `MRB_USE_LINK_TIME_RO_DATA_P`. (#4716)
223+
224+
## mruby binary (MRB)
225+
226+
- Remove "LINE" section reader. (#4455)
227+
228+
---
229+
# Major bug fixes
230+
231+
- `SystemStackError` is raised from `String#=~`. (#4363)
232+
- Null pointer dereference in ecall. (#4370)
233+
- mismatched shift functions. (#4380)
234+
- Compilation error with "MRB_ARY_EMBED_LEN_MAX" in "array.h". (#4382)
235+
- Fixed a bug in recursive `mrb_top_run` calls; fix (#4384)
236+
- Unexpected error: `Can't get cfunc env from non-cfunc proc.` (#4389)
237+
- build error on master by MRB_WITHOUT_FLOAT. (#4478)
238+
- Null pointer dereference in mrb_str_cat_str. (#4504)
239+
- Some comments do not increment lineno on context. (#4513)
240+
- Null pointer dereference in mrb_check_frozen. (#4519)
241+
- Invalid read in mrb_class. (#4534)
242+
- Array#inspect recurses too much for self-referential arrays. (#4552)
243+
- Infinite loop in Integer#step when both args are INFINITY. (#4555)
244+
- Float#round hangs for large ndigits. (#4566)
245+
- Cannot call `Fiber.yield` in method. (#4567)
246+
- Reference to top-level variable in top-level block is broken. (#4581)
247+
- Bugs with mutually recursive Array and Hash. (#4582)
248+
- `mrb_gc_unregister()` may access freed memory. (#4618)
249+
- memcpy-param-overlap in str_replace_partial. (#4627)
250+
- Symbol#inspect does not handle Unicode characters. (#4678)
251+
- mrb_funcall returns odd value. (#4696)
252+
- behavior of alias is defferent from CRuby. (#4718)
253+
- compile error at master by clang 9. (#4786)
254+
255+
---
256+
257+
We have done 912 commits to 229 files, 12,006 lines were added, 5,382 lines removed since mruby 2.0.1. For more detail of the updates, [see Commit Log](https://github.com/mruby/mruby/compare/2.0.1...stable).
258+
259+
Let's try `mruby 2.1.0`.

0 commit comments

Comments
 (0)