Marc, On Fri, Sep 29, 2017 at 09:40:07AM +0000, Marc Worrell wrote: > Can mix build rebar3 based apps?
Mix is more or less a replacement for rebar3, so they are mutually exclusive, though largely compatible. > If so then we can just provide a mix based project. For Elixir users, the easiest thing is if Zotonic can be used as a library which can be pulled in by mix/rebar from https://hex.pm/, i.e. it's a well behaved OTP application. It might make sense to have some mix tasks which e.g. create template modules. > I am also thinking of using the introspection (we are using that for > notify observers) to discover if a module, filter, action or other > type of Zotonic callback module is an Elixir module. > And if so we could generate or use some glue code to call directly > into the Elixir modules from Zotonic. Generally speaking, Elixir code is functionally the same as Erlang code, the module atoms just start with 'Elixir.', so that may not be necessary. > - M Jake > > On 29 Sep 2017, at 10:49, Jake Morrison <[email protected]> wrote: > > > > On Fri, Sep 29, 2017 at 08:12:53AM +0000, Marc Worrell wrote: > >> Thinking of it… we do use a lot of records for all notifications and > >> postbacks. > >> > >> Are those supported in Elixir? > > > > Records are supported, here is the Elixir syntax: > > https://hexdocs.pm/elixir/Record.html > > Maps are generally easier to deal with than records, though, in both > > languages. > > > > I have converted larger Erlang codebases to Elixir incrementally. The > > first step is generally to switch the project to using using mix, the > > Elixir build tool. Second is to switch to using maps for the core data > > structures, so it's easier to interoperate. Then we do a "mechanical" > > conversion from Erlang to Elixir, as the language semantics are > > essentially the same. Depending on the state of tests in the project, we > > would either use the Erlang tests to validate that things are still > > working properly, or write tests using Elixir's ExUnit and friends. > > Finally we start using the syntax improvements in Elixir to make the code > > nicer. > > > > For interop, doing the first two steps would make things easiest for > > Elixir folks. It adds a dependency on Elixir to build the system, > > though. > > > >> - Marc > > > > Jake > > > >>> On 29 Sep 2017, at 08:54, Kai Janson <[email protected]> wrote: > >>> > >>> Some of the things in the hrl file could be replaced by Elixir macros or > >>> functions? > >>> > >>> On Sep 29, 2017, at 02:51, Marc Worrell <[email protected] > >>> <mailto:[email protected]>> wrote: > >>> > >>>> Hi Allen, > >>>> > >>>> Two weeks ago David de Boer and I had a look at how Elixir and > >>>> Erlang could be mixed. > >>>> > >>>> We concluded that it all should be possible to do with the > >>>> master. But also that we didn’t know enough of Elixir to make it > >>>> frictionless. So we need some help with this. > >>>> > >>>> The master is split in applications, and those will all be pushed > >>>> to Hex. That is a good start for any Elixir setup, I guess. > >>>> > >>>> The main zotonic.hrl is mainly included because we like to poke > >>>> around in #context{} (which we shouldn’t) and to use the ?DEBUG/1 > >>>> macro. > >>>> > >>>> There are some other macros in there, but they are not essential. > >>>> So it is not really needed for building modules etc. > >>>> > >>>> We welcome help to make Zotonic work with Elixir! > >>>> > >>>> Arjan could probably help as well - though he is very busy right > >>>> now. > >>>> > >>>> Cheers, Marc > >>>> > >>>> > >>>>> On 29 Sep 2017, at 03:17, Allen Wyma <[email protected] > >>>>> <mailto:[email protected]>> wrote: > >>>>> > >>>>> Hi, > >>>>> > >>>>> Does anyone have a guide with how to use elixir with Zotonic? > >>>>> We're a ruby house that's looking to switch to elixir, but > >>>>> sometimes we get projects that seem to work better for a CMS. When > >>>>> I saw this project, I was quite amazed and we'd like to start to > >>>>> experiment a bit with it. > >>>>> > >>>>> Is it possible to have a guide of how to use elixir with Zotonic? > >>>>> I've tried looking a bit at the code for erlang, and it includes > >>>>> references to hrl (erlang macro/header files) which are not > >>>>> supported in elixir. This is probably my biggest question of how > >>>>> to translate over the code. > >>>>> > >>>>> Thanks -- --- You received this message because you are subscribed to the Google Groups "Zotonic developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
