Skip to content

Commit 2c98c09

Browse files
author
José Valim
committed
An Elixir module now translates to Elixir.Module instead of Elixir-Module
1 parent 94f9d4e commit 2c98c09

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+79
-165
lines changed

Makefile

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@ INSTALL_PATH := /usr/local
1111
#==> Templates
1212

1313
define APP_TEMPLATE
14-
$(1): lib/$(1)/ebin/Elixir-$(2).beam lib/$(1)/ebin/$(1).app
14+
$(1): lib/$(1)/ebin/Elixir.$(2).beam lib/$(1)/ebin/$(1).app
1515

1616
lib/$(1)/ebin/$(1).app:
1717
@ cd lib/$(1) && ../../bin/elixir -e "Mix.Server.start_link(:dev)" -r mix.exs -e "Mix.Task.run('compile.app')"
1818

19-
lib/$(1)/ebin/Elixir-$(2).beam: $(wildcard lib/$(1)/lib/*.ex) $(wildcard lib/$(1)/lib/*/*.ex) $(wildcard lib/$(1)/lib/*/*/*.ex)
19+
lib/$(1)/ebin/Elixir.$(2).beam: $(wildcard lib/$(1)/lib/*.ex) $(wildcard lib/$(1)/lib/*/*.ex) $(wildcard lib/$(1)/lib/*/*/*.ex)
2020
@ echo "==> $(1) (compile)"
2121
@ $$(ELIXIRC) "lib/$(1)/lib/**/*.ex" -o lib/$(1)/ebin
2222

@@ -27,8 +27,8 @@ endef
2727

2828
#==> Compilation tasks
2929

30-
KERNEL:=lib/elixir/ebin/Elixir-Kernel.beam
31-
UNICODE:=lib/elixir/ebin/Elixir-String-Unicode.beam
30+
KERNEL:=lib/elixir/ebin/Elixir.Kernel.beam
31+
UNICODE:=lib/elixir/ebin/Elixir.String.Unicode.beam
3232

3333
default: compile
3434

@@ -44,7 +44,7 @@ erlang:
4444
# Since Mix depends on EEx and EEx depends on
4545
# Mix, we first compile EEx without the .app
4646
# file, then mix and then compile eex fully
47-
elixir: kernel lib/eex/ebin/Elixir-EEx.beam mix ex_unit eex iex
47+
elixir: kernel lib/eex/ebin/Elixir.EEx.beam mix ex_unit eex iex
4848

4949
kernel: $(KERNEL) VERSION
5050
$(KERNEL): lib/elixir/lib/*.ex lib/elixir/lib/*/*.ex

bin/iex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,4 @@ readlink_f () {
3535

3636
SELF=$(readlink_f "$0")
3737
SCRIPT_PATH=$(dirname "$SELF")
38-
ELIXIR_NO_CLI=1 exec "$SCRIPT_PATH"/elixir --no-halt --erl "-user Elixir-IEx-CLI" +iex "$@"
38+
ELIXIR_NO_CLI=1 exec "$SCRIPT_PATH"/elixir --no-halt --erl "-user Elixir.IEx.CLI" +iex "$@"

lib/elixir/lib/binary/inspect.ex

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,15 +144,15 @@ defimpl Binary.Inspect, for: Atom do
144144
end
145145
end
146146

147-
# Detect if atom is an atom alias (Elixir-Foo-Bar-Baz)
147+
# Detect if atom is an atom alias (Elixir.Foo.Bar.Baz)
148148

149149
defp valid_ref_identifier?("Elixir" <> rest) do
150150
valid_ref_piece?(rest)
151151
end
152152

153153
defp valid_ref_identifier?(_), do: false
154154

155-
defp valid_ref_piece?(<<?-, h, t :: binary>>) when h in ?A..?Z do
155+
defp valid_ref_piece?(<<?., h, t :: binary>>) when h in ?A..?Z do
156156
valid_ref_piece? valid_identifier?(t)
157157
end
158158

@@ -296,7 +296,7 @@ defimpl Binary.Inspect, for: List do
296296

297297
defp keyword?([{ key, _value } | rest]) when is_atom(key) do
298298
case atom_to_list(key) do
299-
'Elixir-' ++ _ -> false
299+
'Elixir.' ++ _ -> false
300300
_ -> keyword?(rest)
301301
end
302302
end

lib/elixir/lib/module.ex

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -528,7 +528,7 @@ defmodule Module do
528528
529529
"""
530530
def split(module) do
531-
tl(String.split(Binary.Chars.to_binary(module), "-"))
531+
tl(String.split(Binary.Chars.to_binary(module), "."))
532532
end
533533

534534
@doc """
@@ -537,13 +537,10 @@ defmodule Module do
537537
def to_binary(Elixir), do: "Elixir"
538538

539539
def to_binary(module) do
540-
"Elixir-" <> rest = Binary.Chars.to_binary(module)
541-
bc <<r>> inbits rest, do: <<to_dot(r)>>
540+
"Elixir." <> rest = Binary.Chars.to_binary(module)
541+
rest
542542
end
543543

544-
defp to_dot(?-), do: ?.
545-
defp to_dot(l), do: l
546-
547544
@doc false
548545
# Used internally to compile documentation. This function
549546
# is private and must be used only internally.

lib/elixir/lib/protocol.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ defmodule Protocol do
267267
true -> unquote(fallback)
268268
false ->
269269
case atom_to_list(first) do
270-
'Elixir-' ++ _ -> __MODULE__.Record
270+
'Elixir.' ++ _ -> __MODULE__.Record
271271
_ -> unquote(fallback)
272272
end
273273
end

lib/elixir/src/elixir.erl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
eval_quoted/2, eval_quoted/3, eval_quoted/4,
77
eval_forms/3, translate_forms/3]).
88
-include("elixir.hrl").
9-
-compile({parse_transform, elixir_transform}).
109

1110
%% Top level types
1211
-export_type([char_list/0, as_boolean/1]).

lib/elixir/src/elixir_aliases.erl

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
-export([nesting_alias/2, last/1, concat/1, safe_concat/1,
33
format_error/1, ensure_loaded/3, ensure_loaded/4, expand/3, store/4]).
44
-include("elixir.hrl").
5-
-compile({parse_transform, elixir_transform}).
65

76
%% Store an alias in the given scope
87
store(_Meta, New, New, S) -> S;
@@ -57,7 +56,7 @@ expand({ '__aliases__', _Meta, List }, _Aliases) ->
5756
List.
5857

5958
expand_one(H, Aliases) ->
60-
Lookup = list_to_atom("Elixir-" ++ atom_to_list(H)),
59+
Lookup = list_to_atom("Elixir." ++ atom_to_list(H)),
6160
case lookup(Lookup, Aliases) of
6261
Lookup -> false;
6362
Else -> Else
@@ -87,9 +86,9 @@ ensure_loaded(Line, File, Ref, FileModules) ->
8786

8887
last(Atom) ->
8988
Last = last(lists:reverse(atom_to_list(Atom)), []),
90-
list_to_atom("Elixir-" ++ Last).
89+
list_to_atom("Elixir." ++ Last).
9190

92-
last([$-|_], Acc) -> Acc;
91+
last([$.|_], Acc) -> Acc;
9392
last([H|T], Acc) -> last(T, [H|Acc]);
9493
last([], Acc) -> Acc.
9594

@@ -118,12 +117,12 @@ nesting_alias(Prefix, Full) ->
118117
do_nesting([X|PreTail], [X|Tail], Acc) ->
119118
do_nesting(PreTail, Tail, [X|Acc]);
120119
do_nesting([], [H|_], Acc) ->
121-
{ list_to_atom("Elixir-" ++ H), concat(lists:reverse([H|Acc])) };
120+
{ list_to_atom("Elixir." ++ H), concat(lists:reverse([H|Acc])) };
122121
do_nesting(_, _, _Acc) ->
123122
false.
124123

125124
list_nesting(Atom) ->
126-
case string:tokens(atom_to_list(Atom), "-") of
125+
case string:tokens(atom_to_list(Atom), ".") of
127126
["Elixir"|T] -> T;
128127
_ -> []
129128
end.
@@ -143,15 +142,9 @@ do_concat(Args) ->
143142

144143
to_partial(Arg) when is_binary(Arg) -> to_partial(binary_to_list(Arg));
145144
to_partial(Arg) when is_atom(Arg) -> to_partial(atom_to_list(Arg));
146-
to_partial("Elixir-" ++ Arg) -> dot_to_dash([$-|Arg]);
147-
to_partial([$-|_] = Arg) -> dot_to_dash(Arg);
148-
to_partial(Arg) when is_list(Arg) -> [$-|dot_to_dash(Arg)].
149-
150-
dot_to_dash(List) ->
151-
[case X of
152-
$. -> $-;
153-
_ -> X
154-
end || X <- List].
145+
to_partial("Elixir." ++ Arg) -> [$.|Arg];
146+
to_partial([$.|_] = Arg) -> Arg;
147+
to_partial(Arg) when is_list(Arg) -> [$.|Arg].
155148

156149
%% Lookup an alias in the current scope.
157150

lib/elixir/src/elixir_compiler.erl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
-export([get_opts/0, get_opt/1, get_opt/2, string/2, file/1, file_to_path/2]).
33
-export([core/0, module/3, eval_forms/4, format_error/1]).
44
-include("elixir.hrl").
5-
-compile({parse_transform, elixir_transform}).
65

76
%% Public API
87

lib/elixir/src/elixir_def.erl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
unwrap_stored_definitions/2,
1616
format_error/1]).
1717
-include("elixir.hrl").
18-
-compile({parse_transform, elixir_transform}).
1918

2019
%% Table management functions. Called internally.
2120

lib/elixir/src/elixir_def_overridable.erl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
-export([store_pending/1, is_defined/2, ensure_defined/4,
44
assign_args/3, retrieve_args/3, name/2, store/3, format_error/1]).
55
-include("elixir.hrl").
6-
-compile({parse_transform, elixir_transform}).
76

87
overridable(Module) ->
98
ets:lookup_element(elixir_module:data_table(Module), '__overridable', 2).

0 commit comments

Comments
 (0)