Coder Social home page Coder Social logo

aeon's People

Contributors

chimucong avatar garret-smith avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

aeon's Issues

Cannot use aeon:record_to_jsx/2 on OTP19

When trying to implement aeon in OTP19, I am not getting any record specification:

** exception error: {no_type,{test,{record,user}}}
     in function  aeon_common:field_types/2 (/home/hazims/src/garret_aeon/_build/default/lib/aeon/src/aeon_common.erl, line 27)
     in call from aeon_to_jsx:record_to_jsx/2 (/home/hazims/src/garret_aeon/_build/default/lib/aeon/src/aeon_to_jsx.erl, line 11)
     in call from test2:test/0 (/home/hazims/src/garret_aeon/_build/default/lib/aeon/src/test2.erl, line 23)

If I try to get the record types defined in the test module:

7> test:'#types'(). 
[{{type,privilege},
  {union,[{atom,login},
          {atom,create},
          {atom,delete},
          {atom,grant}]}}]

The code is:
test1.erl

-module(test).

-compile({parse_transform, runtime_types}).
-compile({parse_transform, exprecs}).

-type privilege() :: login | create | delete | grant.

-record(user, {
          name :: binary(),
          age :: integer(),
          height :: float(),
          birthday :: {Year :: integer(),
                       Month :: integer(),
                       Day :: integer()},
          privileges :: [privilege()]
         }).

-export_type([privilege/0]).
-export_records([user]).

It seems that some of the available record information is not available in OTP19.

Might have something to do with changes in erl_syntax_lib since R16.

//Hazim

Error: undefined parse transform 'runtime_types'

I am trying to compile the test provided in README and getting "undefined parse transform 'runtime_types'" compile time error. What am I missing?

-module(aeon_test).
-compile({parse_transform, runtime_types}).
-compile({parse_transform, exprecs}).
-type privilege() :: login | create | delete | grant.

-record(user, {
          name :: binary(),
          age :: integer(),
          height :: float(),
          birthday :: {Year :: integer(),
                       Month :: integer(),
                       Day :: integer()},
          privileges :: [privilege()]
         }).

-export_type([privilege/0]).
-export_records([user]).

User = #user{
          name = <<"Garret Smith">>,
          age = 34,
          height = 6.0,
          birthday = {1982, 06, 29},
          privileges = [login, create, delete, grant]
         },
Json = jsx:encode(aeon:record_to_jsx(User, test)),
io:fwrite("~s~n", [Json]),

User1 = aeon:to_record(jsx:decode(Json), test, user).

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.