Skip to content

Commit 26640e3

Browse files
author
José Valim
committed
Start v0.9.0.dev work
1 parent 59d6448 commit 26640e3

File tree

18 files changed

+91
-243
lines changed

18 files changed

+91
-243
lines changed

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1+
# v0.9.0.dev
2+
3+
* enhancements
4+
5+
* bug fix
6+
7+
* deprecations
8+
9+
* backwards incompatible changes
10+
* [Kernel] Erlang R15 is no longer supported
11+
112
# v0.8.3 (2013-05-22)
213

314
* enhancements

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ If you want to contribute to Elixir or run it from source, clone this repository
1414

1515
If tests pass, you are ready to move on to the [Getting Started guide][1] or to try Interactive Elixir by running: `bin/iex` in your terminal.
1616

17-
However, if tests fail, it is likely you have an outdated Erlang version (Elixir requires Erlang R15B or later). You can check your Erlang version by calling `erl` in the command line. You will see some information as follow:
17+
However, if tests fail, it is likely you have an outdated Erlang version (Elixir requires Erlang R16B or later). You can check your Erlang version by calling `erl` in the command line. You will see some information as follow:
1818

19-
Erlang R15B (erts-5.8.4) [source] [64-bit] [smp:2:2] [rq:2] [async-threads:0] [hipe] [kernel-poll:false]
19+
Erlang R16B (erts-5.10.1) [source] [64-bit] [smp:2:2] [rq:2] [async-threads:0] [hipe] [kernel-poll:false]
2020

2121
If you have the correct version and tests still fail, feel free to [open an issue][2].
2222

lib/elixir/lib/binary/chars.ex

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -74,20 +74,11 @@ defimpl Binary.Chars, for: Number do
7474
integer_to_binary(thing)
7575
end
7676

77-
to_binary = :proplists.get_value(:float_to_binary,
78-
:proplists.get_value(:exports, :erlang.module_info, []))
79-
80-
if to_binary == 2 do
81-
def to_binary(thing) when thing > @limit do
82-
float_to_binary(thing, scientific: @digits)
83-
end
84-
85-
def to_binary(thing) do
86-
float_to_binary(thing, compact: true, decimals: @digits)
87-
end
88-
else
89-
def to_binary(thing) do
90-
float_to_binary(thing)
91-
end
77+
def to_binary(thing) when thing > @limit do
78+
float_to_binary(thing, scientific: @digits)
79+
end
80+
81+
def to_binary(thing) do
82+
float_to_binary(thing, compact: true, decimals: @digits)
9283
end
9384
end

lib/elixir/lib/binary/inspect.ex

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -391,21 +391,12 @@ defimpl Binary.Inspect, for: Number do
391391
integer_to_binary(thing)
392392
end
393393

394-
to_binary = :proplists.get_value(:float_to_binary,
395-
:proplists.get_value(:exports, :erlang.module_info, []))
396-
397-
if to_binary == 2 do
398-
def inspect(thing, _) when thing > @limit do
399-
float_to_binary(thing, scientific: @digits)
400-
end
394+
def inspect(thing, _) when thing > @limit do
395+
float_to_binary(thing, scientific: @digits)
396+
end
401397

402-
def inspect(thing, _) do
403-
float_to_binary(thing, compact: true, decimals: @digits)
404-
end
405-
else
406-
def inspect(thing, _) do
407-
float_to_binary(thing)
408-
end
398+
def inspect(thing, _) do
399+
float_to_binary(thing, compact: true, decimals: @digits)
409400
end
410401
end
411402

lib/elixir/lib/io/ansi.ex

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,6 @@ defmodule IO.ANSI do
2424
(http://en.wikipedia.org/wiki/ANSI_escape_code) — characters embedded
2525
in the text used to control formatting, color, and other output options
2626
on video text terminals.
27-
28-
Please be aware that in Erlang/OTP versions prior to R16, you will not
29-
be able to render ANSI escape sequences in iex or erlang shell
3027
"""
3128

3229
import IO.ANSI.Sequence
@@ -36,23 +33,11 @@ defmodule IO.ANSI do
3633
3734
Used to identify whether printing ANSI escape sequences will likely
3835
be printed as intended.
39-
40-
Please note that invoked while in shell (iex) in Erlang/OTP
41-
prior to R16, terminal?/0 will always return false because
42-
Erlang shell did not support ANSI escape sequences up until
43-
R16.
4436
"""
4537
@spec terminal? :: boolean
4638
@spec terminal?(:io.device) :: boolean
4739
def terminal?(device // :erlang.group_leader) do
48-
if :erlang.system_info(:otp_release) < 'R16' and
49-
Process.whereis(:user) != device do
50-
# Shell prior to R16 doesn't support ANSI escape
51-
# sequences
52-
false
53-
else
54-
match?({:ok, _}, :io.columns(device))
55-
end
40+
match?({:ok, _}, :io.columns(device))
5641
end
5742

5843
@doc "Resets all attributes"

lib/elixir/lib/kernel.ex

Lines changed: 26 additions & 104 deletions
Original file line numberDiff line numberDiff line change
@@ -2000,41 +2000,18 @@ defmodule Kernel do
20002000
Elixir conventions (i.e. it expects the tuple as first argument,
20012001
zero-index based).
20022002
2003-
Please note that in versions of Erlang prior to R16B there is no BIF
2004-
for this operation and it is emulated by converting the tuple to a list
2005-
and back and is, therefore, inefficient.
2006-
20072003
## Example
20082004
20092005
iex> tuple = { :bar, :baz }
20102006
...> insert_elem(tuple, 0, :foo)
20112007
{ :foo, :bar, :baz }
20122008
"""
20132009
defmacro insert_elem(tuple, index, value) when is_integer(index) do
2014-
case :proplists.get_value(:insert_element,
2015-
:proplists.get_value(:exports, :erlang.module_info,[])) do
2016-
3 ->
2017-
quote do: :erlang.insert_element(unquote(index + 1), unquote(tuple), unquote(value))
2018-
:undefined ->
2019-
do_insert_elem(tuple, index, value)
2020-
end
2021-
end
2022-
defmacro insert_elem(tuple, index, value) do
2023-
case :proplists.get_value(:insert_element,
2024-
:proplists.get_value(:exports, :erlang.module_info,[])) do
2025-
3 ->
2026-
quote do: :erlang.insert_element(unquote(index) + 1, unquote(tuple), unquote(value))
2027-
:undefined ->
2028-
do_insert_elem(tuple, index, value)
2029-
end
2010+
quote do: :erlang.insert_element(unquote(index + 1), unquote(tuple), unquote(value))
20302011
end
20312012
2032-
defp do_insert_elem(tuple, index, value) do
2033-
quote do
2034-
{h, t} = :lists.split(unquote(index),
2035-
tuple_to_list(unquote(tuple)))
2036-
list_to_tuple(h ++ [unquote(value)|t])
2037-
end
2013+
defmacro insert_elem(tuple, index, value) do
2014+
quote do: :erlang.insert_element(unquote(index) + 1, unquote(tuple), unquote(value))
20382015
end
20392016
20402017
@doc """
@@ -2053,30 +2030,11 @@ defmodule Kernel do
20532030
{ :bar, :baz }
20542031
"""
20552032
defmacro delete_elem(tuple, index) when is_integer(index) do
2056-
case :proplists.get_value(:delete_element,
2057-
:proplists.get_value(:exports, :erlang.module_info,[])) do
2058-
2 ->
2059-
quote do: :erlang.delete_element(unquote(index + 1), unquote(tuple))
2060-
:undefined ->
2061-
do_delete_elem(tuple, index)
2062-
end
2063-
end
2064-
defmacro delete_elem(tuple, index) do
2065-
case :proplists.get_value(:delete_element,
2066-
:proplists.get_value(:exports, :erlang.module_info,[])) do
2067-
2 ->
2068-
quote do: :erlang.delete_element(unquote(index) + 1, unquote(tuple))
2069-
:undefined ->
2070-
do_delete_elem(tuple, index)
2071-
end
2033+
quote do: :erlang.delete_element(unquote(index + 1), unquote(tuple))
20722034
end
20732035
2074-
defp do_delete_elem(tuple, index) do
2075-
quote do
2076-
{h, [_|t]} = :lists.split(unquote(index),
2077-
tuple_to_list(unquote(tuple)))
2078-
list_to_tuple(h ++ t)
2079-
end
2036+
defmacro delete_elem(tuple, index) do
2037+
quote do: :erlang.delete_element(unquote(index) + 1, unquote(tuple))
20802038
end
20812039
20822040
@doc """
@@ -2654,15 +2612,7 @@ defmodule Kernel do
26542612
123
26552613
26562614
"""
2657-
defmacro binary_to_integer(some_binary) do
2658-
case :proplists.get_value(:binary_to_integer,
2659-
:proplists.get_value(:exports, :erlang.module_info, [])) do
2660-
2 ->
2661-
quote do: :erlang.binary_to_integer(unquote(some_binary))
2662-
:undefined ->
2663-
quote do: list_to_integer(binary_to_list(unquote(some_binary)))
2664-
end
2665-
end
2615+
def binary_to_integer(some_binary)
26662616

26672617
@doc """
26682618
Returns an integer whose text representation in base `base`
@@ -2674,15 +2624,7 @@ defmodule Kernel do
26742624
1023
26752625
26762626
"""
2677-
defmacro binary_to_integer(some_binary, base) do
2678-
case :proplists.get_value(:binary_to_integer,
2679-
:proplists.get_value(:exports, :erlang.module_info, [])) do
2680-
2 ->
2681-
quote do: :erlang.binary_to_integer(unquote(some_binary), unquote(base))
2682-
:undefined ->
2683-
quote do: list_to_integer(binary_to_list(unquote(some_binary)), unquote(base))
2684-
end
2685-
end
2627+
def binary_to_integer(some_binary, base)
26862628

26872629
@doc """
26882630
Returns a float whose text representation is `some_binary`.
@@ -2693,15 +2635,7 @@ defmodule Kernel do
26932635
2.2017764
26942636
26952637
"""
2696-
defmacro binary_to_float(some_binary) do
2697-
case :proplists.get_value(:binary_to_float,
2698-
:proplists.get_value(:exports, :erlang.module_info, [])) do
2699-
1 ->
2700-
quote do: :erlang.binary_to_float(unquote(some_binary))
2701-
:undefined ->
2702-
quote do: list_to_float(binary_to_list(unquote(some_binary)))
2703-
end
2704-
end
2638+
def binary_to_float(some_binary)
27052639

27062640
@doc """
27072641
Returns a binary which corresponds to the text representation
@@ -2713,35 +2647,19 @@ defmodule Kernel do
27132647
"123"
27142648
27152649
"""
2716-
defmacro integer_to_binary(some_integer) do
2717-
case :proplists.get_value(:integer_to_binary,
2718-
:proplists.get_value(:exports, :erlang.module_info, [])) do
2719-
2 ->
2720-
quote do: :erlang.integer_to_binary(unquote(some_integer))
2721-
:undefined ->
2722-
quote do: list_to_binary(integer_to_list(unquote(some_integer)))
2723-
end
2724-
end
2650+
def integer_to_binary(some_integer)
27252651

27262652
@doc """
27272653
Returns a binary which corresponds to the text representation
27282654
of `some_integer` in base `base`.
27292655
27302656
## Examples
27312657
2732-
iex> integer_to_binary(77)
2733-
"77"
2658+
iex> integer_to_binary(100, 16)
2659+
"64"
27342660
27352661
"""
2736-
defmacro integer_to_binary(some_integer, base) do
2737-
case :proplists.get_value(:integer_to_binary,
2738-
:proplists.get_value(:exports, :erlang.module_info, [])) do
2739-
2 ->
2740-
quote do: :erlang.integer_to_binary(unquote(some_integer), unquote(base))
2741-
:undefined ->
2742-
quote do: list_to_binary(integer_to_list(unquote(some_integer), unquote(base)))
2743-
end
2744-
end
2662+
def integer_to_binary(some_integer, base)
27452663

27462664
@doc """
27472665
Returns a binary which corresponds to the text representation
@@ -2753,15 +2671,7 @@ defmodule Kernel do
27532671
"7.00000000000000000000e+00"
27542672
27552673
"""
2756-
defmacro float_to_binary(some_float) do
2757-
case :proplists.get_value(:float_to_binary,
2758-
:proplists.get_value(:exports, :erlang.module_info, [])) do
2759-
2 ->
2760-
quote do: :erlang.float_to_binary(unquote(some_float))
2761-
:undefined ->
2762-
quote do: list_to_binary(float_to_list(unquote(some_float)))
2763-
end
2764-
end
2674+
def float_to_binary(some_float)
27652675

27662676
@doc """
27672677
Returns a binary which corresponds to the text representation
@@ -2782,6 +2692,18 @@ defmodule Kernel do
27822692
:erlang.float_to_binary(float, expand_compact(options))
27832693
end
27842694

2695+
@doc """
2696+
Returns a list which corresponds to the char list representation
2697+
of `some_float`.
2698+
2699+
## Examples
2700+
2701+
iex> float_to_binary(7.0)
2702+
'7.00000000000000000000e+00'
2703+
2704+
"""
2705+
def float_to_list(some_float)
2706+
27852707
@doc """
27862708
Returns a list which corresponds to the text representation
27872709
of `float`.

lib/elixir/lib/list/chars.ex

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -34,20 +34,11 @@ defimpl List.Chars, for: Number do
3434
integer_to_list(thing)
3535
end
3636

37-
to_list = :proplists.get_value(:float_to_list,
38-
:proplists.get_value(:exports, :erlang.module_info, []))
39-
40-
if to_list == 2 do
41-
def to_char_list(thing) when thing > @limit do
42-
float_to_list(thing, scientific: @digits)
43-
end
44-
45-
def to_char_list(thing) do
46-
float_to_list(thing, compact: true, decimals: @digits)
47-
end
48-
else
49-
def to_char_list(thing) do
50-
float_to_list(thing)
51-
end
37+
def to_char_list(thing) when thing > @limit do
38+
float_to_list(thing, scientific: @digits)
5239
end
53-
end
40+
41+
def to_char_list(thing) do
42+
float_to_list(thing, compact: true, decimals: @digits)
43+
end
44+
end

lib/elixir/lib/system.ex

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -294,19 +294,11 @@ defmodule System do
294294
def halt(status // 0, options // [])
295295

296296
def halt(status, options) when is_integer(status) or status == :abort do
297-
do_halt(status, options)
297+
:erlang.halt(status, options)
298298
end
299299

300300
def halt(status, options) do
301-
do_halt(to_char_list(status), options)
302-
end
303-
304-
# Support R15B
305-
if { :halt, 2 } in :erlang.module_info(:exports) do
306-
defp do_halt(status, options), do: :erlang.halt(status, options)
307-
else
308-
IO.puts "Using limited halt support. Upgrade to R15B01 or later is recommended."
309-
defp do_halt(status, _options), do: :erlang.halt(status)
301+
:erlang.halt(to_char_list(status), options)
310302
end
311303

312304
## Helpers

lib/elixir/rebar.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,4 @@
2424
{verbose, false}
2525
]}.
2626

27-
{require_otp_vsn,"(R15|R16).*"}.
27+
{require_otp_vsn,"(R16).*"}.

0 commit comments

Comments
 (0)