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

Importing functions from other files #21

Closed
torch2424 opened this issue Jan 31, 2018 · 6 comments
Closed

Importing functions from other files #21

torch2424 opened this issue Jan 31, 2018 · 6 comments
Labels

Comments

@torch2424
Copy link
Contributor

torch2424 commented Jan 31, 2018

Hello! I'm currently working on a large project (for fun) in Assembly script.

And I couldn't quite figure out how to split out my code into multiple files, to be imported/exported in an index.ts.

Here is a link to my assemblyscript files in my repo

I know the project is still very new, and if it is not implemented yet, no worries! Thanks for making this awesome project!

P.S I'm hoping I can find time to contribute, because I'm really looking forward to using this in more projects in the future 😄

@dcodeIO
Copy link
Member

dcodeIO commented Jan 31, 2018

Exports and imports should just work, that is if you are using current master.

@torch2424
Copy link
Contributor Author

Hello!

Thanks for the super quick reply!

So I pulled the latest mater on January, 23rd, has it changed since then?

and if it is not too much to ask, could you post a quick code example?

And again, thanks for all the hard work!

@dcodeIO
Copy link
Member

dcodeIO commented Jan 31, 2018

has it changed since then?

It's constantly changing, but I haven't touched imports/exports recently.

could you post a quick code example?

There's this test for example.

@torch2424
Copy link
Contributor Author

torch2424 commented Jan 31, 2018

Oh that's perfect thanks! Do you mind if I contribute a simple project example under the examples displaying exports and imports? Maybe something like a small Fibonacci sequence or something.

Also on the topic of that, I know Maps are incomplete, but if I were to expose them like sets in assembly definitions could I use the functionality they currently have?

And you solved this issue, I'll close it after your next reply, thank you for your time!

@dcodeIO
Copy link
Member

dcodeIO commented Jan 31, 2018

Maybe something like a small Fibonacci sequence or something.

Not sure, I am trying to provide somewhat meaningful examples and exports and imports are already mentioned in the showcase test.

I know Maps are incomplete, but if I were to expose them like sets in assembly definitions could I use the functionality they currently have?

You can try, but be warned that these aren't real set/map implementations, just untested fillers using arrays under the hood. Also note that string keys won't work yet because operator overloads aren't evaluated yet.

@torch2424
Copy link
Contributor Author

Ahhh makes sense, cool, thank you! I'll be sure to look through the tests if I need to figure something out.

If I come up with another contribution idea, I'll make an issue to discuss.

Again, thanks for your help! Closing this!

willemneal pushed a commit to willemneal/assemblyscript that referenced this issue May 31, 2019
radu-matei pushed a commit to radu-matei/assemblyscript that referenced this issue Oct 13, 2020
* Optimizations + update dependencies

* update yarn.lock as well

* more

* improve dirName

* more

Co-authored-by: Frank Denis <124872+jedisct1@users.noreply.github.com>
radu-matei pushed a commit to radu-matei/assemblyscript that referenced this issue Oct 13, 2020
* 'master' of github.com:jedisct1/wasa:
  Fixed the memory leak for Time.sleep (AssemblyScript#33)
  Improve Descriptor (AssemblyScript#25)
  Bump assemblyscript from 0.9.2 to 0.9.4 (AssemblyScript#27)
  Deps
  Optimizations + update dependencies (AssemblyScript#21)
  Bump @as-pect/cli from 2.7.0 to 2.8.1 (AssemblyScript#23)
  Bump assemblyscript from 0.9.1 to 0.9.2 (AssemblyScript#24)
  Fix Date.now to return milliseconds instead of microseconds (AssemblyScript#19)
  Bump assemblyscript from 0.9.0 to 0.9.1 (AssemblyScript#17)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants