Giter Club home page Giter Club logo

elixir's Introduction

Elixir logo

CI

Elixir is a dynamic, functional language designed for building scalable and maintainable applications.

For more about Elixir, installation and documentation, check Elixir's website.

Policies

New releases are announced in the announcement mailing list. You can subscribe by sending an email to [email protected] and replying to the confirmation email.

All security releases will be tagged with [security]. For more information, please read our Security Policy.

All interactions in our official communication channels follow our Code of Conduct.

Bug reports

For reporting bugs, visit our issue tracker and follow the steps for reporting a new issue. Please disclose security vulnerabilities privately at [email protected].

Issues tracker management

All currently open bugs related to the Elixir repository are listed in the issues tracker. The Elixir team uses the issues tracker to focus on actionable items, including planned enhancements in the short and medium term. We also do our best to label entries for clarity and to ease collaboration.

Our actionable item policy has some important consequences, such as:

  • Proposing new features as well as requests for support, help, and guidance must be done in their own spaces, detailed next.

  • Issues we have identified to be outside of Elixir's scope, such as an upstream bug, will be closed (and requested to be moved elsewhere if appropriate).

  • We actively close unrelated and non-actionable issues to keep the issues tracker tidy. We may get things wrong from time to time and will gladly revisit issues, reopening when necessary.

Keep the tone positive and be kind! For more information, see the Code of Conduct.

Proposing new features

For proposing new features, please start a discussion in the Elixir Core mailing list. The language development history and its focus are described on our website.

Keep in mind that it is your responsibility to argue and explain why a feature is useful and how it will impact the codebase and the community. A good proposal includes the problem description and how the proposed solution compares with existing alternatives in the Elixir ecosystem (as well as in other languages). To iron out a proposal before submission, consider using and gathering feedback from the community spaces listed on the sidebar of the Elixir website.

Once a proposal is accepted, it will be added to the issue tracker. Features and bug fixes that have already been merged and will be included in the next release are then "closed" and added to the changelog.

Discussions, support, and help

For general discussions, support, and help, please use the community spaces listed on the sidebar of the Elixir website, such as forums, chat platforms, etc, where the wider community will be available to help you.

Compiling from source

For the many different ways to install Elixir, see our installation instructions on the website. However, if you want to contribute to Elixir, you will need to compile from source.

First, install Erlang. After that, clone this repository to your machine, compile and test it:

git clone https://github.com/elixir-lang/elixir.git
cd elixir
make

Note: if you are running on Windows, this article includes important notes for compiling Elixir from source on Windows.

In case you want to use this Elixir version as your system version, you need to add the bin directory to your PATH environment variable.

Additionally, you may choose to run the test suite with make clean test.

Contributing

We invite contributions to Elixir. To contribute, there are a few things you need to know about the code. First, Elixir code is divided by each application inside the lib folder:

  • elixir - Elixir's kernel and standard library

  • eex - EEx is the template engine that allows you to embed Elixir

  • ex_unit - ExUnit is a simple test framework that ships with Elixir

  • iex - IEx stands for Interactive Elixir: Elixir's interactive shell

  • logger - Logger is the built-in logger

  • mix - Mix is Elixir's build tool

You can run all tests in the root directory with make test. You can also run tests for a specific framework with make test_#{APPLICATION}, for example, make test_ex_unit. If you just changed something in Elixir's standard library, you can run only that portion through make test_stdlib.

If you are only changing one file, you can choose to compile and run tests for that specific file for faster development cycles. For example, if you are changing the String module, you can compile it and run its tests as:

bin/elixirc lib/elixir/lib/string.ex -o lib/elixir/ebin
bin/elixir lib/elixir/test/elixir/string_test.exs

Some test files need their test_helper.exs to be explicitly required before, such as:

bin/elixir -r lib/logger/test/test_helper.exs lib/logger/test/logger_test.exs

You can also use the LINE env var to run a single test:

LINE=123 bin/elixir lib/elixir/test/elixir/string_test.exs

To recompile all (including Erlang modules):

make compile

After your changes are done, please remember to run make format to guarantee all files are properly formatted, then run the full suite with make test.

If your contribution fails during the bootstrapping of the language, you can rebuild the language from scratch with:

make clean_elixir compile

Similarly, if you can not get Elixir to compile or the tests to pass after updating an existing checkout, run make clean compile. You can check the official build status. More tasks can be found by reading the Makefile.

With tests running and passing, you are ready to contribute to Elixir and send a pull request. We have saved some excellent pull requests we have received in the past in case you are looking for some examples:

Reviewing changes

Once a pull request is sent, the Elixir team will review your changes. We outline our process below to clarify the roles of everyone involved.

All pull requests must be approved by two committers before being merged into the repository. If changes are necessary, the team will leave appropriate comments requesting changes to the code. Unfortunately, we cannot guarantee a pull request will be merged, even when modifications are requested, as the Elixir team will re-evaluate the contribution as it changes.

Committers may also push style changes directly to your branch. If you would rather manage all changes yourself, you can disable the "Allow edits from maintainers" feature when submitting your pull request.

The Elixir team may optionally assign someone to review a pull request. If someone is assigned, they must explicitly approve the code before another team member can merge it.

When the review finishes, your pull request will be squashed and merged into the repository. If you have carefully organized your commits and believe they should be merged without squashing, please mention it in a comment.

Building documentation

Building the documentation requires that ExDoc is installed and built alongside Elixir:

# After cloning and compiling Elixir, in its parent directory:
git clone https://github.com/elixir-lang/ex_doc.git
cd ex_doc && ../elixir/bin/elixir ../elixir/bin/mix do deps.get + compile

Now go back to Elixir's root directory and run:

make docs                  # to generate HTML pages
make docs DOCS_FORMAT=epub # to generate EPUB documents

This will produce documentation sets for elixir, eex, ex_unit, iex, logger, and mix under the doc directory. If you are planning to contribute documentation, please check our best practices for writing documentation.

Development links

License

"Elixir" and the Elixir logo are registered trademarks of The Elixir Team.

Elixir source code is released under Apache License 2.0.

Check NOTICE and LICENSE files for more information.

elixir's People

Contributors

alco avatar amatalai avatar andrzejsliwa avatar chyndman avatar defipanda avatar devonestes avatar eksperimental avatar ericentin avatar ericmj avatar fertapric avatar fishcakez avatar fxn avatar ggcampinho avatar gusaiani avatar josephwilk avatar josevalim avatar jwarwick avatar lexmag avatar lukaszsamson avatar meh avatar michallepicki avatar michalmuskala avatar rafaelfranca avatar sabiwara avatar v0idpwn avatar vanstee avatar viniciusmuller avatar whatyouhide avatar wojtekmach avatar yrashk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

elixir's Issues

require and import interface

If some features may give necessary power, but at the same time may lead to very complex code,
then usually people design interface to them harder then usual, but possible.

For example in Ruby, when you want to assign instance variable with custom name
then you should write very long method name (instance_variable_set).

According to README.md require recommened to use with only:, why just don't make it by default?
Like:

require Orddict, [values: 1]
%% but:
require Orddict, import_all_to_scope: true

Something like that.

Another question: why there are two different methods for importing: require and import? Can they be combined?

Rename namespace to module

We should rename:

  1. ns macro to module
  2. __NAMESPACE__ to __MODULE__
  3. Rename src/elixir_namespace.erl to src/elixir_module.erl

And any other reference we may find.

cannot bind h to list head in iex

trying to follow the examples in the tutorial, i get this:

Interactive Elixir (0.3.1.dev)
Running on Erlang R14B01 (erts-5.8.2) [source] [64-bit] [smp:2:2] [rq:2] [async-threads:0] [hipe] [kernel-poll:false]

iex> h
** error 'undef
    IEX::Context#h(<#IEX::Context {}>)
    erl_eval#do_apply/5
    elixir#eval/5
    IEX::Behavior#loop/0
iex> [h|t] = [1,2,3]
[1,2,3]
iex> h
** error {'unbound,'h}
    erl_eval#expr/3
iex> i
** error 'undef
    IEX::Context#i(<#IEX::Context {}>)
    erl_eval#do_apply/5
    elixir#eval/5
    IEX::Behavior#loop/0
iex> [x|y] = [1,2,3]
[1,2,3]
iex> x
1
iex> y
[2,3]
iex> 

is there anything special about h in iex?

make test failure

Running archlinux, with erlang R14B, with elixir git commit 26bec31

Stdout and Stderr
Running Erlang tests ...
time erl -I include -noshell -pa ebin test/ebin -eval 'test_helper:test(), halt().'

=INFO REPORT==== 23-Mar-2011::22:23:12 ===
application: elixir
exited: {bad_return,
{{elixir,start,[normal,[]]},
{'EXIT',
{function_clause,
[{filename,do_flatten,
[<<"kernel/include/file.hrl">>,[]]},
{filename,split,1},
{'File::Mixin',split,2},
{'Record::Mixin',retrieve,3},
{'Record::Definition',record,3},
{erl_eval,do_apply,5},
{erl_eval,exprs,5},
{elixir_object,compile,8}]}}}}
type: temporary
All 210 tests passed.
1.03user 0.18system 0:02.06elapsed 58%CPU (0avgtext+0avgdata 68608maxresident)k
0inputs+0outputs (0major+7248minor)pagefaults 0swaps

Running Elixir tests ...
time bin/exunit test/elixir/*_test.ex
{"init terminating in do_boot",{{noconstant,'Code::Init'},[{elixir_errors,error,1},{elixir,start,0},{init,start_it,1},{init,start_em,1}]}}

Crash dump was written to: erl_crash.dump

init terminating in do_boot ()

real 0m2.502s
user 0m0.518s
sys 0m1.692s
make: *** [test_elixir] Error 1

make test fails with erlang R14B03

(master))% erl
Erlang R14B03 (erts-5.8.4) [source] [smp:8:8] [rq:8] [async-threads:0] [hipe] [kernel-poll:false]

Eshell V5.8.4 (abort with ^G)
1>
BREAK: (a)bort (c)ontinue (p)roc info (i)nfo (l)oaded
(v)ersion (k)ill (D)b-tables (d)istribution
a
(master))% make test
Compiling Erlang source ...
erlc -I include -W0 -o ebin src/*.erl

Compiling lexer ...
erl -I include -noshell -pa ebin -eval 'leex:file("src/elixir_lexer.xrl"), halt().'
Parsing file src/elixir_lexer.xrl, contained 69 rules.
NFA contains 1436 states, DFA contains 1459 states, minimised to 644 states.
Writing file src/elixir_lexer.erl, open error
erlc -I include -W0 -o ebin src/elixir_lexer.erl
src/elixir_lexer.erl:none: no such file or directory
make: *** [src/elixir_lexer.erl] Error 1

It appears to fail to write out the lexer after it gets generated. But I even chmod'd the src dir to 0777 to make sure it wasn't a permissions problem and thats not it. Any clues?

Thanks
-Ezra

Chained list accessing fails to parse

iex> a = [1, 2, [3, 4]]
[1,2,[3,4]]
iex> a[2][1]
** error 
nofile:1: syntax error before:  '['
    elixir_errors#error/1
    elixir_transform#parse/3
    elixir#eval/5
    IEX::Proto#loop/0
iex>

Wrapping the receiver in parens works fine (e.g. (a[2])[1]).

named args

many erlang functions accepts list of options (usually it's list of tupples). i think, that this is not cool. now we should use list of tuples too or funcs with default args, but in this case there is constant order of args, so it's not good too.

named args can solve this problem.

Tuple#[] and List#[] return 'nomethod when wrong argument type is given

This is insane stuff because I cannot imagine why someone would want to send a string or atom as a tuple or list index, but if it happens by accident, it will be very helpful to raise a consistent error.

Examples:

Tuple:

{1,2,3}["foo"] # => error 'badarg
{1,2,3}['foo]  # => error {'nomethod,{'"+",1,'foo}}

List:

[1,2,3]['foo]  # => error {'nomethod,{'"-",1,'foo}}
[1,2,3]["foo"] # => error {'nomethod,{'"-",1,"foo"}}

I believe it should always raise 'badarg for consistency

How reloading can work?

elixir_module is too strict for old modules:

check_module_available(ElixirName) ->
try
ErrorInfo = elixir_constants:lookup(ElixirName, attributes),
[{ErrorFile,ErrorLine}] = proplists:get_value(exfile, ErrorInfo),
error({module_defined, {ElixirName, list_to_binary(ErrorFile), ErrorLine}})
catch
error:{no_module, _} -> []
end.

Proper procedure is to call

Erlang.code.soft_purge('ex + ElixirName) and then overload module.

`make test` failed

I found that unit test failed since de49179.

The error message is:

{"init terminating in do_boot",{{yecc_bug,"1.3",{missing_state_in_action_table,294}},[{elixir_parser,yeccpars2,7},{elixir_parser,yeccpars0,5},{elixir_transform,forms,3},{elixir_transform,parse_and_transform,3},{elixir,parse,3},{elixir,eval,3},{lists,foreach,2},{test_helper,test,0}]}}

510a79a is the last good commit.

If-statement in body causes warning message

When running following code:

module Iftest
  def test
    if true
      IO.puts "if true works"
    else
      IO.puts "if true fails"
    end

    if false
      IO.puts "if false fails"
    else
      IO.puts "if false works"
    end
  end
end

Iftest.test

It works properly, but it causes some Erlang warning messages:

src/../play/iftest2.ex:3: this clause cannot match because of different types/sizes
src/../play/iftest2.ex:9: this clause cannot match because of different types/sizes

However, if the if-statement is not in a function body, the warning message is not shown:

if true
  IO.puts "if true works"
else
  IO.puts "if true fails"
end

if false
  IO.puts "if false fails"
else
  IO.puts "if false works"
end

Sample code is available at my repository:

Test fails

Below is the erlang version I'm using...

Erlang R14B02 (erts-5.8.3) [source] [64-bit] [smp:2:2] [rq:2] [async-threads:0] [hipe] [kernel-poll:false]

... and the failing test:

1) utc_test(DateTimeTest)
  error {'badmatch,{{2011,4,12},{22,14,7}}}
  stacktrace:
    DateTimeTest::Proto#utc_test/0
    ExUnit#run_tests/4
    ExUnit#run/2
    ExUnit#run/0
    erl_eval#do_apply/5
    elixir#eval/5
    Code::Init#-process_argv/2-lc$^0/1-0-/2
    Code::Init#-process_argv/2-lc$^0/1-0-/2

Thanks!

Too much typing!!!

Hi There,

I love the idea of elixir. But I really really hate the "end" statements. It's ugly, long and meaningless. How about some python style syntax like ifn? It would shorten the code by 20 to 30% in many cases and improve readability.

Eric

Empty rescue block causes compile error

This causes compile error:

  begin
    IO.puts result.inspect
  rescue 'error: _
  end

But this works:

  begin
    IO.puts result.inspect
  rescue 'error: _
    []
  end

I think this should work as if-else block and automatically yield []

Define elem/setelem as macros

They should be the same as element/setelement but using the proper parameters order. They need to be macros so they can still be used in guards.

`for tuple in var do` raises syntax error

Code sample:

for ({ verb, extra } in right) do
  contents = quote do
    defp unquote(name).(unquote(verb), [], dict) do
      { :ok, unquote(extra), dict }
    end
  end

  Module.eval_quoted module, contents, [], __FILE__, __LINE__
end

Build fails

Extracted from here: http://build.erlagner.org/browse/AGNER-NIGHTLYPKGS-JOB1-130/test/case/2527965

Compiling Erlang source ...
erlc -I include -W0 -o ebin src/*.erl

Compiling Elixir source ...
erl -I include -noshell -pa ebin -s elixir_compiler core -s erlang halt
{\"init terminating in do_boot\",{undef,[{elixir_lexer,string,[\"% elixir: cache

object Object
  module Methods
    % Create a new object using the current object as parent
    %
    % ## Example
    %
    %     obj = Object.new
    %     obj.__parent__ %=> 'Object
    %
    % ## Notes
    %
    % The new method is special cased by the compiler to receive
    % all arguments wrapped into a single array.
    def new(args)
      Erlang.elixir_object_methods.new(self, args)
    end

    def mixin(module)
      Erlang.elixir_object_methods.mixin(self, module)
    end

    def proto(module)
      Erlang.elixir_object_methods.proto(self, module)
    end

    def __name__
      Erlang.elixir_object_methods.name(self)
    end

    def __parent_name__
      Erlang.elixir_object_methods.parent_name(self)
    end

    def __parent__
      Erlang.elixir_object_methods.parent(self)
    end

    % Returns a list of atoms representing all mixins for the current object.
    % The mixins chain is retrieved by getting the current object mixins and
    % appending all protos from its parents.
    %
    % ## Example
    %
    % Imagine the following definition:
    %
    %     object Foo
    %       mixin SomeMethods
    %       proto MoreMethods
    %     end
    %
    % The mixins chain for Foo is:
    %
    %     Foo.__mixins__  % => ['SomeMethods, 'Object::Methods]
    %
    % Where `SomeMethods` is a module mixed into `Foo` and the `Object::Methods`
    % is a module added as proto on `Foo` parent, which is the object `Object`:
    %
    %     Foo.__parent__  % => 'Object
    %
    % The mixins for `Foo.new` are these:
    %
    %     Foo.new.__mixins__ %=> ['MoreMethods, 'Object::Methods]
    %
    % Where `MoreMethods` is a module added as proto to `Foo.new` parent (which is `Foo`)
    % and `Object::Methods` is a proto on `Foo.new` grandparent (which is `Object`).
    %
    % If we added a mixin to `Foo.new`, we would have the following result:
    %
    %     Foo.new.mixin(MuchMoreMethods).__mixins__ %=> ['MuchMoreMethods, 'MoreMethods, 'Object::Methods]
    %
    % In other words, calculating the mixins chain is as simple as:
    %
    %     [self.exclusive_mixins, self.parent.exclusive_protos, self.parent.parent.exclusive_protos, ...]
    %
    % Until parent becomes empty (`Object` is the only object that does not have a parent).
    %
    % Notice that we don't have methods called `exclusive_mixins` and `exclusive_protos`,
    % they are mentioned just as examples.
    %
    % == Mixins inside object definitions
    %
    % In Elixir, all methods are carried in modules. Regular objects does not have methods per-se.
    % However, for convenience, Elixir allows you to define methods inside the object definition:
    %
    %     object Foo
    %       def bar
    %         'baz
    %       end
    %     end
    %
    % What happens internally is that Elixir automatically creates a module named `Foo::Proto`
    % and automatically adds it as `Foo` proto. In order for this to work properly, Elixir
    % adds `Module::Methods` as mixin during the object definition, but it is removed from
    % the mixins chain after the object is defined:
    %
    %     object Foo
    %       __mixins__   % => ['Module::Methods, 'Object::Methods]
    %     end
    %
    %     Foo.__mixins__ % => ['Object::Methods]
    %
    def __mixins__
      Erlang.elixir_object_methods.mixins(self)
    end

    % Returns a list of atoms representing all proto for the current object.
    % The mixins chain is retrieved by getting the current object protos and
    % appending all protos from its parents.
    %
    % ## Example
    %
    % Imagine the following definition:
    %
    %     object Foo
    %       mixin SomeMethods
    %       proto MoreMethods
    %     end
    %
    % The protos chain for Foo is:
    %
    %     Foo.__protos__  % => ['MoreMethods, 'Object::Methods]
    %     Foo.new.__protos__  % => ['MoreMethods, 'Object::Methods]
    %
    % The lookup for protos happens in a similar fashion to mixins:
    %
    %     [self.exclusive_protos, self.parent.exclusive_protos, self.parent.parent.exclusive_protos, ...]
    %
    % Read the documentation for `__mixins__` for more information.
    def __protos__
      Erlang.elixir_object_methods.protos(self)
    end

    def __ancestors__
      Erlang.elixir_object_methods.ancestors(self)
    end

    def inspect
      name = __name__
      if name != []
        name.to_s
      else
        \\"<#{__parent_name__} #{get_ivars.inspect}>\\"
      end
    end

    def to_s
      self.inspect
    end

    def initialize
      self
    end

    def get_ivar(name)
      Erlang.elixir_object_methods.get_ivar(self, name)
    end

    % Returns a `Dict` with all variable names and values as its key-values.
    %
    % ## Example
    %
    %     object Foo
    %       def initialize
    %         @('bar: 1, 'baz: 2)
    %       end
    %     end
    %
    %     Foo.new.__ivars__ % => { 'bar: 1, 'baz: 2 }
    %
    def get_ivars
      OrderedDict.new Erlang.elixir_object_methods.data(self)
    end

    def set_ivar(name, value)
      Erlang.elixir_object_methods.set_ivar(self, name, value)
    end

    def set_ivars(value)
      Erlang.elixir_object_methods.set_ivars(self, value)
    end

    def update_ivar(name, fun)
      Erlang.elixir_object_methods.update_ivar(self, name, fun)
    end

    def update_ivar(name, initial, fun)
      Erlang.elixir_object_methods.update_ivar(self, name, initial, fun)
    end

    def __send__(method, args := [])
      Erlang.elixir_dispatch.dispatch(self, method, args)
    end

    % Those methods are related to methods introspection.

    def __proto_methods__
      Erlang.elixir_methods.proto_methods(self)
    end

    def __mixin_methods__
      Erlang.elixir_methods.mixin_methods(self)
    end

    % Exceptions related methods

    def __stacktrace__
      filter_stacktrace Erlang.get_stacktrace
    end

    def error(reason)
      Erlang.error(reason)
    end

    def throw(reason)
      Erlang.throw(reason)
    end

    def exit(reason)
      Erlang.exit(reason)
    end

    def catch!(function)
      filter_catch_stacktrace Erlang.elixir_object_methods.function_catch(function)
    end

    def method_missing('initialize, args)
      IO.puts \\"[ELIXIR] Defining 'constructor' is deprecated. Please define 'initialize' and return an object.\\"
      @(__send__('constructor, args))
    end

    def method_missing(method, args)
      error { 'nomethod, {self, method, Erlang.length(args)} }
    end

    % Set the following methods to private.
    Erlang.elixir_module_methods.set_visibility(self, 'private)

    def filter_stacktrace(stacktrace)
      filter_stacktrace(stacktrace, [])
    end

    def filter_stacktrace([{raw_module, function, raw_arity}|t], buffer)
      if filtered = filter_stacktrace_module(raw_module.to_char_list)
        module = filtered
        arity = if raw_arity.__parent_name__ == 'Integer
          raw_arity - 1
        else
          raw_arity
        end
      else
        module = raw_module
        arity = raw_arity
      end

      filter_stacktrace t, [{module, function, arity}|buffer]
    end

    def filter_stacktrace([], buffer)
      buffer.reverse
    end

    def filter_stacktrace_module([$e, $x, h|t]) when h >= $A andalso h <= $Z
      Atom.from_char_list [h|t]
    end

    def filter_stacktrace_module(_)
      nil
    end

    def filter_catch_stacktrace({ 'EXIT, { reason, stacktrace } })
      { 'EXIT, { reason, filter_stacktrace(stacktrace) } }
    end

    def filter_catch_stacktrace(other)
      other
    end
  end

  % Object::Methods is automatically mixed and proto'd by Elixir
  % runtime so we can bootstrap the object system.
  % mixin Object::Methods
  % proto Object::Methods
end\",1]},{elixir_transform,forms,3},{elixir_transform,parse,3},{elixir,eval,5},{elixir_compiler,'-core/0-lc$^0/1-0-',1},{elixir_compiler,core,0},{init,start_it,1},{init,start_em,1}]}}\r
\r
Crash dump was written to: erl_crash.dump\r
init terminating in do_boot ()\r
make: *** [exbin] Error 1
ERROR: Build failed

binary crash

./bin/elixir -v
{"init terminating in do_boot",{undef,[{elixir,start,[]},{init,start_it,1},{init,start_em,1}]}}

Crash dump was written to: erl_crash.dump
init terminating in do_boot ()

OSx 10.6.7
erl -v
Erlang R14B02 (erts-5.8.3) [source] [64-bit] [smp:2:2] [rq:2] [async-threads:0] [hipe] [kernel-poll:false]

File.read() output not safe for binary data in iex

Using this bitmap file works fine in Erlang's REPL, but not Elixir's.

Erlang

1> file:read_file("input.bmp").
{ok,<<66,77,54,4,4,0,0,0,0,0,54,4,0,0,40,0,0,0,0,2,0,0,0,
      2,0,0,1,...>>}

Elixir (via File)

iex> File.read("input.bmp")
** error 'badarg
*** ERROR: Shell process terminated! (^G to start new job) ***

=ERROR REPORT==== 16-May-2011::14:21:52 ===
  Error in process <0.35.0> with exit value: {badarg,[{io,format,[standard_error,
  <<263259 bytes>>,[]]},{lists,foreach,2},
  {'exList::Proto',each,2},{'exIEX::Proto',loop,1}]}

Elixir (via direct call to erlang)

iex> Erlang.file.read_file("input.bmp")
** error 'badarg
*** ERROR: Shell process terminated! (^G to start new job) ***

=ERROR REPORT==== 16-May-2011::14:23:19 ===
 Error in process <0.35.0> with exit value: {badarg,[{io,format,[standard_error,
 <<263265 bytes>>,[]]},{lists,foreach,2},{'exList::Proto',each,2},{'exIEX::Proto',loop,1}]}

I suspect that this is because iex is not sanitizing the strings that it presents on the console, and that somehow these values are being interpreted as printable characters? Possible fix may be to have a read option that returns a Bit String rather than a regular String?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.