Commit Graph
85 Commits
Author SHA1 Message Date
José Valim a0eef07958 No need to require for requires for all expansions 2013-12-21 22:00:42 +01:00
José Valim bb05011dca Expand quote 2013-12-19 20:42:33 +01:00
José Valim 8847f8ed68 Start locals expansion 2013-12-19 15:33:13 +01:00
José Valim a33cbbe6b1 Simplify import dispatching 2013-12-18 17:24:32 +01:00
José Valim f62c26b9b6 Ensure record aliases in the same quote can be accessed, closes #1915
This commit also simplifies macro expansion for both imports and aliases
to always give higher preference to the macro environment rather than
the caller one, if such is available. The deal is to simplify both the
code and understanding of how macros work.
2013-12-07 20:01:11 +01:00
José Valim e424f02812 Ensure aliases defined in macros do not leak 2013-11-30 18:02:46 +01:00
José Valim 043edd4990 location: :keep only affect function definitions
This commit changes how metadata is stored once location: :keep
is used and also removes the __scope__ special form.

Closes #1877
2013-11-25 11:35:00 +01:00
José Valim da34ccd54e Simplify lookups in elixir_dispatch 2013-11-25 09:06:01 +01:00
José Valim a8bdd19a03 Implement defmodule in Elixir 2013-11-24 11:53:41 +01:00
José Valim f685f5d2a5 Implement left in right in Elixir 2013-11-23 12:21:07 +01:00
José Valim b28c95d31a Move case/try/receive to special forms 2013-11-23 10:35:10 +01:00
José Valim abec6af3ac Move function/macro definitions to Kernel 2013-11-23 10:17:57 +01:00
José Valim 2655a318c2 Move some macros back to __op__ to work around bug in erl_eval 2013-11-22 15:42:12 +01:00
José Valim 398e0fd3fb Convert remaining operators 2013-11-22 14:39:11 +01:00
José Valim de3c0f639a Move more operators to Kernel 2013-11-22 13:44:37 +01:00
José Valim 1096cd00b9 Move arithmetic ops to Kernel 2013-11-22 13:29:02 +01:00
José Valim 260be7c8ea Start porting elixir_macros to pure elixir 2013-11-22 12:55:51 +01:00
José Valim 572726cf65 Remove unecessary apply optimization 2013-11-12 14:29:17 +01:00
John Warwick e40375a65f underscorize unused argument 2013-11-06 14:11:30 -05:00
José Valim 0d3aa7fd66 Improve some Kernel error messages 2013-11-06 16:14:31 +01:00
José Valim aba0d5ba3f Simplify current module macro handling 2013-11-01 16:03:13 +01:00
José Valim 5bd12f9cb9 Move lexical tracker to scope 2013-11-01 16:03:12 +01:00
José Valim 3c151d5357 Add Kernel.LexicalTracker 2013-11-01 16:03:12 +01:00
José Valim f1e2fcf9f9 Same module variables must be explicitly shared
Prior to this commit, the following code would work:

    defmodule Hello do
      defmacro write do
        quote do
          a = 1
        end
      end

      defmacro read do
        quote do
          a
        end
      end
    end

    require Hello
    Hello.write
    Hello.read

Although this is convenient, it has many issues:

1. It is not clear at any point the intent of sharing the variables
   in between the macros

2. Whenever macros from the same module are nested, there is a chance
   a variable used before and after the nesting to be overriden

We address this issue by only allowing variables explicitly marked
with var! to be shared. Here is how the example above should be updated:

    defmodule Hello do
      defmacro write do
        quote do
          var!(a, Hello) = 1
        end
      end

      defmacro read do
        quote do
          var!(a, Hello)
        end
      end
    end

    require Hello
    Hello.write
    Hello.read
2013-10-30 16:15:19 +01:00
José Valim cd74bd5d54 Also deprecate atom<->binary conversions with encoding 2013-10-18 22:18:57 +02:00
José Valim 429548ea75 Remove pid conversions from Kernel, clean up String conversions 2013-10-18 19:16:17 +02:00
José Valim f510d4c3df Normalize all stacktrace under the same name and improve IEx errors
Kudos to @pragdave for suggesting some those improvements and
providing an initial implementation in pull request #1752.
2013-10-08 20:47:21 +02:00
José Valim 4caa2e01f1 Move is_odd and is_even to Integer 2013-09-03 09:41:55 -03:00
José Valim cea31f69dc Review and deprecate list <-> binary conversion 2013-08-14 11:16:37 +02:00
José Valim d8393f97ca Remove deprecated code 2013-08-06 17:21:40 +02:00
José Valim c6f9287ce7 Only raise on local macro conflicts if it was previously defined 2013-08-02 09:53:30 +02:00
José Valim 46fae17b7e Allow &() as a general capture mechanism 2013-07-31 14:53:22 +02:00
José Valim 095ac686cc Add expansion callsite to the end of the stacktrace, closes #1426 2013-07-16 11:40:18 +02:00
José Valim 2fee17e709 Deprecate Kernel.float/1 in favor of explicit conversion 2013-07-12 12:38:08 +02:00
José Valim 1c7a37a2b7 Raise proper exception on invalid quoted expression
We also documented valid types in Macro.t

Closes #1411
2013-07-12 09:29:57 +02:00
José Valim 15c1a9891c Implement bindings in Elixir 2013-07-04 10:18:46 +02:00
José Valim c572cb80fc Support binding/2 that goes across all contexts 2013-06-19 14:17:45 +02:00
José Valim d3122ddcc5 Add binding/0 and binding/1 for retrieving bindings 2013-06-18 16:14:03 +02:00
José Valim 19ff7a03f9 Ensure imports inside quotes are properly registered, closes #1225 2013-06-16 13:18:47 +02:00
José Valim 80e41f8b4b Allow +, -, and friends to be called dynamically
Our compiler still inline those calls. This commit simply
allows one to write:

    mod = Kernel
    mod.+(1, 2)
2013-06-15 10:45:12 +02:00
José Valim d19f6beca0 Provide source information to all dispatches and complement the API 2013-05-26 20:20:23 +02:00
José Valim da84a797b0 Module.DispatchTracker also records remotes 2013-05-26 20:20:23 +02:00
José Valim ffc91e3004 Rename Kernel.LocalsTracker to Module.DispatchTracker 2013-05-26 14:39:02 +02:00
José Valim c3e7543e48 Extract imports handling to locals tracker (soon to be renamed) 2013-05-26 14:39:02 +02:00
José Valim c3dd4006b0 Reduce atom footprint when compiling an elixir module 2013-05-25 16:37:33 +02:00
José Valim d757f31ccd Unused functions with cyclic dependencies are now also warned as unused
Closes #1105
2013-05-25 00:14:37 +02:00
José Valim 86e7069a0a Clean up how we store recorded locals in the imports table 2013-05-24 12:57:28 +02:00
José Valim 2c98c0999d An Elixir module now translates to Elixir.Module instead of Elixir-Module 2013-05-23 14:36:56 +02:00
José Valim 65e67cdc27 Ensure we emit a warning for recursive non used calls 2013-05-22 19:41:03 +02:00
José Valim 26640e3940 Start v0.9.0.dev work 2013-05-22 14:56:26 +02:00