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

[WIKI]: Document using Source functions in modules #76

Open
2 tasks done
martin-henz opened this issue Jul 8, 2021 · 4 comments
Open
2 tasks done

[WIKI]: Document using Source functions in modules #76

martin-henz opened this issue Jul 8, 2021 · 4 comments
Labels
Documentation [Category]

Comments

@martin-henz
Copy link
Member

martin-henz commented Jul 8, 2021

Feature

How can I use Source functions in the implementation of a module?

Maybe

import { array_length } from "sicp";

Checklist

  • I checked the requested feature does not already exist
  • I checked to make sure that this issue has not already been filed
@martin-henz martin-henz added Enhancement [Category] New feature request proposal Tentative suggestion inviting discussion labels Jul 8, 2021
@houruomu
Copy link
Contributor

Is 'sicp' a module here? If yes then we can write something like import {xxx} from '../sicp/index.ts';

@leeyi45
Copy link
Contributor

leeyi45 commented Apr 16, 2023

Has this been adequately addressed by #192?

@martin-henz
Copy link
Member Author

Has this been adequately addressed by #192?

I think yes. But is this documented anywhere?

@Cloud7050
Copy link
Contributor

I am unsure if this has since been documented somewhere, but developers should now be able to see how to use real js-slang types and functions by referring to existing modules which have since adopted the new technology.

import {
  head,
  list,
  tail,
  type List,
  is_list,
} from 'js-slang/dist/stdlib/list';

It is worth noting that if a file uses js-slang functions (excluding types - types appear to be ok), then that file must not be imported by any tab, or building will fail. This may or may not get addressed down the line, removed as a limitation via updates to the build system. Longer explanation:

https://github.com/Cloud7050/modules/blob/fd66e351a89332ebb1008b513e9233106bf8881f/src/bundles/csg/functions.ts#L97-L108

@Cloud7050 Cloud7050 added Documentation [Category] and removed Enhancement [Category] New feature request proposal Tentative suggestion inviting discussion labels Sep 7, 2023
@Cloud7050 Cloud7050 changed the title [Feature Request]: using Source functions in module [WIKI]: Document using Source functions in modules Sep 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Documentation [Category]
Projects
None yet
Development

No branches or pull requests

4 participants