Re: [m-users.] Free and Ground in the same error line?
"Sean Charles (emacstheviking)" <[email protected]> Sat, 28 Oct 2023 16:59:57 +0100
| Newsgroups | gmane.comp.lang.mercury.general |
|---|---|
| Message-ID | <[email protected]> |
> On 28 Oct 2023, at 16:53, Tomas By <[email protected]> wrote: > > On Sat, 28 Oct 2023 17:29:13 +0200, Sean Charles (emacstheviking) wrote: >> I've also been contemplating making a command line tool out of the >> term-rewriting example code > > This is a good idea, it is very easy in Mercury, with the token & > parser libraries. The file I played with was 'expand_term.m' in the samples folder. Perhaps I might try to tinker with it and find a little job for it in this evenings hack session on my transpiler... this might be the red pill though...... > > >> My main issue was finding operators that aren't already taken [...] >> in Mercury you have to find something not used by any modules you've >> imported > > You can switch to `use_module' instead of `import_module' for those > that have names you want. Then your name has preference and the > library ones need qualifier. I know that but if I use 'use_module' I have to prefix everything with the module name. Ironically, I use import_module most of the time for the standard libraries but I still qualify the name e.g. 'list.is_empty' or 'string.format' etc. I tend to use 'use' when I have a module that encapsulates something with state, for example in my proof of concept video game I have an on-screen display module called 'osd' which I then ':-use_module osd', and then OSD = osd.init, osd.step_update(FrameTime, !OSD) I read somewhere in the Mercury docs very early on when I started learning that one is supposed to qualify predicates/functions with the module name for readbility. It's a habit that has stuck I guess. > > /Tomas _______________________________________________ users mailing list [email protected] https://lists.mercurylang.org/listinfo/users