hare

[hare] The Hare programming language
git clone https://git.torresjrjr.com/hare.git
Log | Files | Refs | README | LICENSE

commit 6391a5c245f57ff59eae1e4538076601e853916b
parent 72058e38cf07d3ecc9f70d2e7b5588a15676c8b0
Author: Jose Lombera <jose@lombera.dev>
Date:   Wed,  7 Sep 2022 01:08:27 -0500

log: make default and silent loggers const

This prevents user from directly modifying pointers to these loggers,
ensuring they remain semantically correct.

For example, now the following produces a compilation error:

    log::default = log::silent;

Signed-off-by: Jose Lombera <jose@lombera.dev>

Diffstat:
Mlog/global.ha | 2+-
Mlog/silent.ha | 2+-
2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/log/global.ha b/log/global.ha @@ -5,7 +5,7 @@ use os; let global: *logger = &_default; // Default logger that writes to [[os::stderr]]. -export let default: *logger = &_default; +export const default: *logger = &_default; let _default: stdlogger = stdlogger { println = &log_println, diff --git a/log/silent.ha b/log/silent.ha @@ -1,7 +1,7 @@ use fmt; // A logger that does not print any messages. -export let silent: *logger = &_silent; +export const silent: *logger = &_silent; let _silent: logger = logger { println = &silent_println,