don't spam the console

This commit is contained in:
Scott Richmond 2025-07-09 15:15:12 -04:00
parent 6c663f598f
commit 044d7e6dd0
3 changed files with 19 additions and 19 deletions

View File

@ -112,7 +112,7 @@ pub fn chars(x: &Value) -> Value {
} }
pub fn words(str: &Value) -> Value { pub fn words(str: &Value) -> Value {
console_log!("wordsing words"); // console_log!("wordsing words");
let str = Value::as_string(str); let str = Value::as_string(str);
let mut words = Vector::new(); let mut words = Vector::new();
let mut word = String::new(); let mut word = String::new();
@ -124,7 +124,7 @@ pub fn words(str: &Value) -> Value {
word = String::new() word = String::new()
} }
} }
console_log!("words gathered into vector; returning to ludus"); // console_log!("words gathered into vector; returning to ludus");
Value::list(words) Value::list(words)
} }

View File

@ -95,7 +95,7 @@ pub async fn do_io (msgs: Vec<MsgOut>) -> Vec<MsgIn> {
if !inbox.is_empty() { if !inbox.is_empty() {
// console_log!("ludus received messages"); // console_log!("ludus received messages");
for msg in inbox.iter() { for msg in inbox.iter() {
console_log!("{}", msg); // console_log!("{}", msg);
} }
} }
inbox inbox

View File

@ -256,7 +256,7 @@ impl Creature {
} }
fn broadcast_panic(&mut self) { fn broadcast_panic(&mut self) {
console_log!("broadcasting panic in {}", self.pid); // console_log!("broadcasting panic in {}", self.pid);
let Err(panic) = self.result.clone().unwrap() else { let Err(panic) = self.result.clone().unwrap() else {
unreachable!("expected panic in broadcast panic"); unreachable!("expected panic in broadcast panic");
}; };
@ -369,7 +369,7 @@ impl Creature {
} }
"yield" => { "yield" => {
self.r#yield = true; self.r#yield = true;
console_log!("yielding from {}", self.pid); // console_log!("yielding from {}", self.pid);
self.push(Value::Keyword("ok")); self.push(Value::Keyword("ok"));
} }
"alive" => { "alive" => {
@ -389,19 +389,19 @@ impl Creature {
"flush" => { "flush" => {
let msgs = self.mbx.iter().cloned().collect::<Vec<_>>(); let msgs = self.mbx.iter().cloned().collect::<Vec<_>>();
let msgs = Vector::from(msgs); let msgs = Vector::from(msgs);
console_log!( // console_log!(
"delivering messages: {}", // "delivering messages: {}",
msgs.iter() // msgs.iter()
.map(|x| x.show()) // .map(|x| x.show())
.collect::<Vec<_>>() // .collect::<Vec<_>>()
.join(" | ") // .join(" | ")
); // );
self.mbx = VecDeque::new(); self.mbx = VecDeque::new();
console_log!("flushing messages in {}", self.pid); // console_log!("flushing messages in {}", self.pid);
self.push(Value::List(Box::new(msgs))); self.push(Value::List(Box::new(msgs)));
} }
"sleep" => { "sleep" => {
console_log!("sleeping {} for {}", self.pid, args[1]); // console_log!("sleeping {} for {}", self.pid, args[1]);
let Value::Number(ms) = args[1] else { let Value::Number(ms) = args[1] else {
unreachable!() unreachable!()
}; };
@ -584,7 +584,7 @@ impl Creature {
PanicNoLetMatch => { PanicNoLetMatch => {
if !self.matches { if !self.matches {
self.ip -= 2; self.ip -= 2;
console_log!("panic at bytecode {}", self.ip); // console_log!("panic at bytecode {}", self.ip);
return self.panic(PanicMsg::NoLetMatch); return self.panic(PanicMsg::NoLetMatch);
} }
} }
@ -793,10 +793,10 @@ impl Creature {
let dict = match self.get_value_at(dict_idx) { let dict = match self.get_value_at(dict_idx) {
Value::Dict(dict) => dict, Value::Dict(dict) => dict,
value => { value => {
console_log!( // console_log!(
"internal Ludus error in function {}", // "internal Ludus error in function {}",
self.frame.function.as_fn().name() // self.frame.function.as_fn().name()
); // );
unreachable!("expected dict, got {value}") unreachable!("expected dict, got {value}")
} }
}; };