Commit Graph
552 Commits
Author SHA1 Message Date
José Valim 174f031efd Eval should take into account other contexts 2013-10-30 16:15:19 +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 67ac77fdb3 Sigils can now handle balanced tokens as in %s(f(o)o)
Closes #1480
2013-10-26 14:08:04 +02:00
José Valim 0171e201fb Move parsing from elixir_interpolations to elixir_parser 2013-10-26 13:46:01 +02:00
José Valim ed2c41837a Clean up escape char duplication 2013-10-26 13:46:00 +02:00
José Valim 404f77421a Refactor string interpolation to delegate to the tokenizer
This refactoring helps us clean up the interpolation code and
guarantee it works as expected since it goes under the same
tokenization rules. It also helps provide better sigil handling
(going to be improved in upcoming commits).
2013-10-25 13:19:47 +02:00
José Valim 1e0daad1b1 Merge pull request #1803 from fishcakez/fix/try_else_support
Document try else clause
2013-10-24 13:40:53 -07:00
José Valim 0b3c91bf6d Do not wrap fn -> end in do keyword
The previous AST came from the fact `fn -> end` was a shortcut
for `function do ... end`. But now since the original no longer
exists, it seems saner to update `fn -> end` AST.
2013-10-24 22:38:25 +02:00
James Fish 446f5dc2c3 Document try else clause 2013-10-24 21:11:58 +01:00
elegua e63e4d44a3 Fixed interpolation per issue 1758 2013-10-24 11:25:34 -07:00
James Fish f751deea85 Fix elixir_errors.erl specs to include binary path 2013-10-22 18:23:35 +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 997a0857c3 Avoid flattening in access[...], closes #1763 2013-10-18 14:54:49 +02:00
José Valim d7ab47cddb Lists are already a literal, they don't require a :[] container 2013-10-18 10:51:04 +02:00
José Valim bae4c1c4c8 Merge pull request #1750 from elixir-lang/jv-protocols
Implement protocol consolidation
2013-10-10 03:45:30 -07: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 3cf9774b92 Improve warn on invalid expressions 2013-10-07 20:16:54 +02:00
José Valim 436cdde499 Fix bug where nested defmodule was shadowing alias hygiene 2013-10-07 13:57:07 +02:00
José Valim 5cb06e9640 Allow a module to force its debug_info to be compiled 2013-10-07 10:16:02 +02:00
José Valim 4997bc1e10 Remove deprecated and unused code branches 2013-10-04 21:39:55 +02:00
José Valim 60b2928678 Ensure &() works on blocks with one expressoin, closes #1704 2013-09-29 21:53:04 +02:00
José Valim ea5df228ed String module now depends on Regex module 2013-09-29 13:39:45 +02:00
José Valim 4b317a75d8 Save typespecs attributes with proper line numbers, closes #1613 2013-09-29 13:15:33 +02:00
José Valim d92b2e6831 Avoid calling Kernel:raise from erl 2013-09-25 11:34:37 +02:00
José Valim f8c66c8516 Remove unecessary vars cache 2013-09-24 13:21:58 +02:00
José Valim 9839bfa4ad Deprecate previous partial application syntax 2013-09-14 09:56:40 -03:00
José Valim 212acf437a Provide better exceptions for invalid unquote args, closes #1680 2013-09-11 12:19:41 -03:00
José Valim 14272c98b4 Improve invalid match and guard errors, closes #1673 2013-09-11 11:21:10 -03:00
José Valim c3bdfc9ba7 No need to mark typedoc as persisted if we are manually persisting it 2013-09-10 12:46:22 -03:00
José Valim 2f5afcaab9 Merge pull request #1637 from pminten/typedoc-rebased
Typedoc rebased
2013-09-10 08:01:18 -07:00
Aleksey Gureiev 8dbfcba237 added handling of multiple heredocs on the same line 2013-09-07 17:59:40 +03:00
José Valim 9f81ac89e5 Remove previously deprecated code 2013-09-03 15:37:02 -03:00
José Valim 4caa2e01f1 Move is_odd and is_even to Integer 2013-09-03 09:41:55 -03:00
José Valim 488344839a Allow any function identifier as a variable, closes #1649 2013-08-25 10:28:55 -03:00
José Valim f02f90fce0 Merge pull request #1648 from pminten/quote-improper-lists
Allow Macro.escape([1|2])
2013-08-25 03:45:37 -07:00
Peter Minten c73919993d Allow Macro.escape([1|2])
This fixes #1646
2013-08-25 09:35:08 +02:00
José Valim 4a0db2e974 Handle more types on bitsyntax. 2013-08-24 16:07:55 -03:00
José Valim 55aad68512 Splice nested binaries with default types and size 2013-08-24 15:55:24 -03:00
José Valim da50584060 Deprecate def/4 and friends in favor of def/2 with unquote and friends 2013-08-23 19:42:20 +02:00
José Valim a6cdc835a1 No need to wrap quote do: nil in a block 2013-08-23 11:22:11 +02:00
Peter Minten a5ea8a63bf Use typedoc attribute to store typedocs.
This requires a bit of a workaround because `typedoc` is also used to store the
doc of the next type to be defined. We store typedocs in the docs table when
types are defined and later filter them out and put them into `typedoc`.
2013-08-22 16:30:24 +02:00
Peter Minten 1be3335f0b Add a @typedoc attribute to document types
Also a new `Kernel.Typespec.beam_typedocs` function to get the typedoc
information.
2013-08-22 16:30:24 +02:00
José Valim 0510512375 Deprecate to_binary in favor of to_string
We also rename Binary.Chars to String.Chars.

As Binary.Chars was the protocol used for interpolation,
it is semantically correct to have a protocol that works
on strings, instead of raw binaries.
2013-08-22 12:19:30 +02:00
José Valim 0e1aac32f5 import accept :functions and :macros as values in :only
This commit removes the previous ambiguous syntax:

    import :functions, Foo

In favor of:

    import Foo, only: :functions
2013-08-22 10:34:45 +02:00
José Valim 8b02a2a7a0 Convert external functions into quoted expressions 2013-08-20 23:52:00 +02:00
José Valim 3e1099830a Properly handle @file that comes from warnings 2013-08-20 11:39:29 +02:00
José Valim f84b4121ce Allow << _ :: utf8 >> <> binary in matches, closes #1619 2013-08-18 14:36:54 +02:00
José Valim ff2af55e1d Improve warning for ungrouped clauses 2013-08-18 10:05:36 +02:00
Stratos Voukelatos 42339679e0 Fixed comment typo in lib/elixir/src/elixir_translator.erl 2013-08-16 00:34:23 +03:00