Skip to content

Importing modules in assessments #2

Open
@martin-henz

Description

@martin-henz

The current mission format allows us to select from a fixed set of libraries, such as TWO_DIM_RUNES, as in

    <DEPLOYMENT interpreter="2">
        <EXTERNAL name="TWO_DIM_RUNES">
            <SYMBOL>beside</SYMBOL>
            <SYMBOL>make_cross</SYMBOL>
            ...

These libraries are currently hard-wired into the Source Academy frontend. I suggest that we instead use JavaScript modules that we take from a folder lib in this assessments repository. More specifically, the IMPORT tag will include a relative path that is extended by the Source Academy to a full path to the master assessment repository of the Source Academy github organization.

Example:

    <DEPLOYMENT interpreter="2">
        <IMPORT module="cs1101s_1920/two_dim_runes">
            <SYMBOL>beside</SYMBOL>
            <SYMBOL>make_cross</SYMBOL>

This assessment would load the following module:

https://github.com/source-academy/assessments/tree/master/lib/cs1101s_1920/two_dim_runes.js

as if it was imported as follows:

import { beside, make_cross } from 'two_dim_runes';

assuming that the module two_dim_runes is written like this:

export function beside(x, y) {
    return ...;
}
export function make_cross(x) {
    return ...;
}

Views?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Enhancement[Category] New feature requestpostponed[Priority]proposalTentative suggestion inviting discussion

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions