Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implementing missing guards #165

Open
arkgil opened this issue Mar 31, 2017 · 2 comments
Open

Implementing missing guards #165

arkgil opened this issue Mar 31, 2017 · 2 comments

Comments

@arkgil
Copy link

arkgil commented Mar 31, 2017

Hi,
@j14159, during your talk at EEF you mentioned that not all guards are implemented yet, and that it's a good opportunity for a newcomer. If it's not being tackled by anyone yet, I'd like to implement them. Could you give me a hint on where could I start? I think it's a good opportunity to learn just a bit how Alpaca works internally 🙂

@j14159
Copy link
Collaborator

j14159 commented Mar 31, 2017

Great idea! Happy to answer questions and point out where to start :) If you were looking for a particular check to begin with, something like is_port is probably good.

You'll want to add type checks to the scanner to start, here's where they're initially defined:
https://github.com/alpaca-lang/alpaca/blob/master/src/alpaca_scan.xrl#L30

Type definitions for them should go in the builtins file. This is what the type inferencer (alpaca_typer.erl) uses to figure out what type is actually being yielded by a guard:
https://github.com/alpaca-lang/alpaca/blob/master/src/builtin_types.hrl

And you will likely need to change a few simple things in alpaca_typer.erl and alpaca_codegen.erl too. Can't recall exactly what off the top of my head but happy to answer more questions here or in IRC! In terms of testing I'd suggest writing a simple Alpaca file that lives in test_files/ and gets compiled and loaded in a test in alpaca.erl, you might want to write something that uses the FFI to even call out to Erlang libraries :D

@arkgil
Copy link
Author

arkgil commented Apr 1, 2017

Thanks, I guess I need to join IRC then 😉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants