Commit Graph
6111 Commits
Author SHA1 Message Date
Aleksei Magusev c60ebb90bb Use "option" instead of "keyword" in error message for alias 2017-03-26 15:14:14 +02:00
Aleksei Magusev cc33b340b0 Improve test of discouraged types in TypespecTest 2017-03-26 15:14:14 +02:00
Aleksei Magusev 4a5822a90e Remove unnecessary calls to abs/1 2017-03-26 15:14:14 +02:00
Eksperimental d020b187a5 Remove unused import in Calendar.ISO (#5930)
Introduced in d017c5ab12.
2017-03-25 17:58:32 +01:00
Andrea Leopardi ed1c9489d4 Replace compile_error/4 with form_error/4 in elixir_erl_compiler (#5925) 2017-03-25 17:02:59 +01:00
Jeff Kreeftmeijer efa05882d0 Restore (deprecated) Integer.to_char_list/2 (#5928) 2017-03-25 14:05:54 +01:00
Michał Muskała 7034721ae9 Inline Map.replace!/3 and comments about inlining (#5922) 2017-03-25 13:44:01 +01:00
Andrea Leopardi 6311c0313e Properly document passing strings to Module.split/1 (#5927) 2017-03-24 14:17:02 -07:00
Andrea Leopardi f128d209d0 Minor improvements to the docs and specs in the Module module 2017-03-24 11:40:08 -07:00
Eksperimental eb0f3ea6eb Add typespecs and guards for the Module module (#5869) 2017-03-24 11:00:40 -07:00
Andrea Leopardi 97810dd836 Mention :sys.suspend/2 and :sys.resume/2 in the GenServer documentation
[ci skip]
2017-03-23 16:47:23 -07:00
José Valim c5a3ca4cdb Properly inline code and remove warnings 2017-03-23 19:01:13 +01:00
Qqwy / Wiebe-Marten 3f88ab745e {Map, Keyword}.replace/3 and replace!/3 (#5917) 2017-03-23 18:52:50 +01:00
José Valim 2d6e0fa476 Improvements to calendar 2017-03-23 18:37:30 +01:00
José Valim c6d3c8c1db Do not use _underscore_ notation on markdown
We don't use this syntax anywhere else in the codebase.
2017-03-23 17:59:19 +01:00
Qqwy / Wiebe-Marten d017c5ab12 Adds internal Calendar Rata Die format for conversions between Calendars (#5841) 2017-03-23 17:55:38 +01:00
Andrea Leopardi cd3e792ecd Use GenServer.stop/3 instead of :gen.stop/3 in Agent.stop/3 (#5915) 2017-03-23 08:35:57 -07:00
Andrea Leopardi b8371afbfb Replace compile_error/4 with form_error/4 in elixir_import (#5916) 2017-03-23 08:30:46 -07:00
Andrea Leopardi f9354b4c6d Polish the documentation for the Agent module 2017-03-22 19:14:20 -07:00
Andrea Leopardi 1d372e93ed Ensure Access.at/1 guards for integer index instead of just positive 2017-03-22 18:47:03 -07:00
Andrea Leopardi 0e06c36064 Polish the documentation for the Access module 2017-03-22 18:45:36 -07:00
Andrea Leopardi b32d37fbab Mention Erlang-style modules in the documentation for Module.split/1 2017-03-22 07:43:26 -07:00
Michał Muskała f046508497 Enum refactoring (#5818)
* Avoid do_ prefixing

* Refactor list functions to be body-recursive where sensible

  The reasoning is the same as in #3811 and 99e0d8e.

* Use recursive functions to optimize filter/reject for lists

  ----- With input: Big (10 Million) -----
  Name           ips        average  deviation         median
  tail          1.64      610.99 ms    ±13.78%      577.63 ms
  body          1.48      675.90 ms    ±10.06%      681.08 ms
  for           1.46      687.19 ms    ±12.84%      693.82 ms

  Comparison:
  tail          1.64
  body          1.48 - 1.11x slower
  for           1.46 - 1.12x slower

  ----- With input: Medium (100 Thousand) -----
  Name           ips        average  deviation         median
  tail        201.60        4.96 ms    ±15.12%        4.81 ms
  body        199.52        5.01 ms    ±14.03%        4.76 ms
  for         178.95        5.59 ms    ±14.50%        5.39 ms

  Comparison:
  tail        201.60
  body        199.52 - 1.01x slower
  for         178.95 - 1.13x slower

  ---- With input: Small (1 Thousand) -----
  Name           ips        average  deviation         median
  body       23.98 K       41.70 μs    ±38.90%       38.00 μs
  tail       21.35 K       46.84 μs    ±35.64%       44.00 μs
  for        18.64 K       53.63 μs    ±31.60%       50.00 μs

  Comparison:
  body       23.98 K
  tail       21.35 K - 1.12x slower
  for        18.64 K - 1.29x slower

* Add function guard to group_by/3 back

  It was used for dispatch between the new and deprecated version.
  The guard was erroneously removed in https://github.com/elixir-lang/elixir/commit/99e44a181fb3440ef572be2f9592c94aa0a99ebc#diff-6881431a92cd4e3ea0de82bf2338f8eaL1032.
2017-03-22 01:18:59 +01:00
Michał Muskała 37896aaa3e Perform only single enumerable dispatch on Enum.fetch (#5911) 2017-03-22 00:21:00 +01:00
Eksperimental d3f1fff8a9 Document and test function/0 built-in type (#5908) 2017-03-21 20:32:01 +01:00
Gal Tsubery 9d8ae7d287 Validate options for comprehension (#5907)
This change raises error when invalid keys are give to "for" loops and
prevents silent errors.
2017-03-21 19:41:08 +01:00
Gal Tsubery b8b8e4cd62 Clarify starting value in scan/2 documentation (#5906) 2017-03-21 19:28:02 +01:00
José Valim 99e44a181f Remove function guards as the BadArity and BadFunction reports provide more information than FunctionClauseError 2017-03-20 15:17:17 +01:00
Andrea Leopardi 605a804dc7 Improve docs for Process.link/1 (#5904) 2017-03-20 14:47:42 +01:00
Andrea Leopardi 52f6cb18aa Fix some minor things in docs for some functions in Kernel 2017-03-20 13:22:05 +01:00
Gal Tsubery 0cedfc70d0 Optimize Map.merge/3 by choosing merge direction (#5899) 2017-03-18 21:22:16 +01:00
Gal Tsubery 26e51edb92 Fix documentation of Kernel.use/2 (#5900) 2017-03-18 11:44:27 +01:00
Andrea Leopardi c47ddffedd Fix the behaviour of defdelegate/2 with default arguments (#5894)
When default arguements (\\) are used with defdelegate/2, a function is
generated for each default argument and each generated function calls the
delegate target function with the same arity. For example:

    defdelegate demonitor(monitor_ref, options \\ []), to: :erlang

will be expanded to

    def demonitor(monitor_ref), do: :erlang.demonitor(monitor_ref)
    def demonitor(monitor_ref, options), do: :erlang.demonitor(monitor_ref, options)

However, this seems to "break" the expectation that optional arguments set: when
a function has optional arguments, all the additional functions with lower arity
that are generated by the default arguments only call the function with maximum
arity with the default values provided for the optional arguments.

This means that if :erlang.demonitor/1 had a different behaviour than
:erlang.demonitor/2, then it would be hard to guess why because the expectation
is that demonitor(monitor_ref) only calls demonitor(monitor_ref, []), ending up
always to :erlang.demonitor/2.

This commit fixes this by leaving the signature of the functions to delegate
untouched (with optional arguments if present).
2017-03-16 19:25:23 +01:00
Gal Tsubery c6766f4b2b Add float overflow error message to Tokenizer (#5893) 2017-03-16 17:20:56 +00:00
Eksperimental fc4dc4ad9c Typespecs changes (#5875)
* Be more explicit when describing typespecs

* Add UserDefined types and rename section in Typespecs page

Additionally reduce a Heading level
2017-03-16 17:04:19 +00:00
Eksperimental 1a19645597 Use defdelegate/2 whenever possible in Process module (#5885) 2017-03-16 16:41:46 +00:00
Michał Muskała 1b4fb917aa Improve docs of Process.monitor/1 (#5891) 2017-03-16 17:10:06 +01:00
Eksperimental a2735bbf28 Remove unnecessary indirection in Task.find/2 (#5890) 2017-03-16 16:45:32 +01:00
Gal Tsubery 18757a83f0 Reword String.to_float documentation (#5878)
Clarify the difference between `String.to_float/1` and
`Float.parse/1`
2017-03-16 09:50:44 +01:00
Eksperimental a4545fb8e0 Add spec to Process.sleep/1 (#5884) 2017-03-16 09:49:33 +01:00
eksperimental 7c9cb0db81 Inline functions in Process module 2017-03-16 09:48:54 +01:00
Eksperimental 7357f56526 Add nonempty_charlist/0 built-in type (#5879) 2017-03-16 09:46:19 +01:00
Boshan Sun 63411640d9 Fix typespec for Task.async/1, Task.Supervisor.async/2 and friends 2017-03-16 09:40:05 +01:00
José Valim 6d122fa352 Clarify docs 2017-03-15 16:04:36 +01:00
José Valim 3404a6fd13 Solve race conditions on struct dispatch 2017-03-15 15:46:52 +01:00
Thijs Klaver cc52fedcd7 Typo in uri.ex (#5877) 2017-03-14 10:35:02 +01:00
Eksperimental d1babd70e6 Add missing word in URI module doc (#5874) 2017-03-14 10:33:32 +01:00
José Valim b191f6bf1f Improve docs for URI, closes #5872 2017-03-13 23:09:53 +01:00
Eksperimental 3047d4fa3a Add guard to OptionParser.split/1 (#5868) 2017-03-13 16:13:25 +01:00
Eksperimental bc78815247 Improve docs and guards for File.cp_r/3 (#5867) 2017-03-13 16:01:21 +01:00