Import and export improved

- Import paths are now vname and not sym
- Imports and exports accept multiple space-delimited operators in []

as a result, we can now reliably import and export the operator *

- error reporting ergonomics
This commit is contained in:
2023-08-18 21:10:29 +01:00
parent 3fdabc29da
commit 9186bce956
33 changed files with 269 additions and 228 deletions

View File

@@ -145,7 +145,7 @@ impl<'a, P: MessagePort, ST: StreamTable + 'a> IntoSystem<'a>
constants: io_bindings(i, streams).unwrap_tree(),
code: embed_to_map::<IOEmbed>(".orc", i),
prelude: vec![FileEntry::Import(vec![Import {
path: i.i(&vec![i.i("system"), i.i("io"), i.i("prelude")]),
path: vec![i.i("system"), i.i("io"), i.i("prelude")],
name: None,
}])],
handlers,

View File

@@ -5,8 +5,8 @@ use hashbrown::HashMap;
use crate::foreign::ExternError;
use crate::systems::asynch::MessagePort;
use crate::utils::{take_with_output, Task};
use crate::ThreadPool;
use crate::thread_pool::{Task, ThreadPool};
use crate::utils::take_with_output;
pub trait StreamHandle: Clone + Send {
fn new(id: usize) -> Self;

View File

@@ -1,11 +1,11 @@
import std::num::*
export ::(+, -, *, /, %)
export ::[+ - * / %]
import std::str::*
export ::[++]
import std::bool::*
export ::(==, if, then, else, true, false)
export ::([==], if, then, else, true, false)
import std::fn::*
export ::($, |>, =>, identity, pass, pass2, return)
export ::([$ |> =>], identity, pass, pass2, return)
import std::list
import std::map
import std::option

View File

@@ -41,7 +41,7 @@ impl IntoSystem<'static> for StlConfig {
constants: HashMap::from([(i.i("std"), fns)]),
code: embed_to_map::<StlEmbed>(".orc", i),
prelude: vec![FileEntry::Import(vec![Import {
path: i.i(&[i.i("std"), i.i("prelude")][..]),
path: vec![i.i("std"), i.i("prelude")],
name: None,
}])],
handlers: HandlerTable::new(),