# slope & slp
- - - - - -

## slope

I have been a busy bee with software projects lately. My
days are spent with a toddler and during her naps I code. A
little while ago I wrote a shell and after that I decided
that I wanted to try a programming language again. My
previous language, nimf, was a forth-like stack language. In
practice it was not much fun to use, though was a fun puzzle
every now and again.

The new language, slope, is a scheme-like language. I
borrowed a bit of code for the evaluator and rewrote the
lexer and parser. I then built out a decently large standard
library worth of built-ins. The language diverges a good bit
from scheme, and what scheme it does use is R4RS based. It
is dynamically typed and a lot of procedures will just cast
as needed. The types are:

- symbol (var and procedure names)
- number (implemented as float64 under the hood)
- string
- list
- bool
- IOHandle (open file, net connection, string buffer)
- exception

I think I worked in some good and usable abstractions from
golangs lib and the IOHandle type in particular I really
like. It allows you to not really worry about what the thing
is and just know that if you have an IOHandle that it can
be written to and/or read from... regardless of whether it
is a network connection or a file.

Exceptions can be passed like in golang, or cause a runtime
panic (the default). The behavior is switchable via a proc
call, so different parts of the code can behave differently
as needed. Debugging has been difficult as I have not set
things up to provide line numbers or stack traces. This is
an area I would like to improve. At present a line number
is available if there is a lex/parse error, but not for a
runtime error. Once the code it lexed I no longer retain a
reference to line number. As such, I think to gain that I
will need to have the lexer store the line number along with
the token. Since I keep track of the line number while
lexing I should be able to do it, but it is an extra struct
and some modification to the parser. I will hopefully get
around to it soon.

Aside from the debugging, it is really quite usable. A user
on rawtext.club has been using it and has even used it at
their job. The feedback I have gotten from them is that it
is a nice glue language and they have replaced some shell
scripting with it. Totally not the domain I had thought of
while making it, but really happy that it is useful for
someone! I have loved seeing what they make with it and they
have been a big help finding issues as well as giving some
good guidance that has helped me keep the language pretty
small and not get carried away.


## slp

Over the last week I decided I needed to solve the problem
of modules for slope. Since early days it has had a `load`
procedure that could take a filepath and load slope code
from the given file... but that is not a great way to deal
with modules.

So... I decided a package manager would be a good call. I
worked out a system for module formatting/necessary files.
Then I started writing a package manager. I didnt like the
direction it was going and started and stopped a few times.
Eventually I decided to search git repos for small hobby
package managers for languages. After a good bit of
searching I found an abandoned one written in go (the lang
that I was using for development). It was Apache licensed,
so I forked it and made some sweeping changes to the
codebase. I likely would have eventually landed somewhere
similar, but it definitely saved me hours of mucking around.

The package manager, slp, has been expanded into a working
package system. Module versioning is handled through git
tags and the central package repository/registry holds no
code (just a json file with package info). The current way
to get a package added is to fork the package repository and
open a PR after adding a package. It is more complex than I
would like since not everyone is great with git, but may
want to contibute a module. Given this is a small hobby
project for a language with not enough new features to make
it appealing to many people I do not expect many people to
try to add packages anyway. Right now there are four; two
by me and two by the aforementioned rtc user . The four are:
csv (parsing and writing), ansi (terminal colors and cursor
movement), dlgs (bindings to allow for gui system dialogs on
linux systems), and toolbox (list, date, math, misc good
stuff).

slp can:

- install
- remove
- update
- list all packages
- search packages
- show installed packages
- show details about a package
- generate a module skeleton (dir + required files)
- open docs for a given module

Not bad for a funtime project :-D


- - - -

If you feel like using a slightly cumbersome language that
will feel like a weird version of scheme without a bunch
of scheme features... give it a shot! We'd love to have you.

The examples folder in the slope repo includes a basic
gopher client (the first project for any language I work
in).

All code for the whole project can be found here:

https://git.rawtext.club/slope-lang/


If you made it this far, thanks for reading! I'm definitely
not trying to push my project on people. I am just excited
about it and having a lot of fun, so hopefully this kind of
writeup is taken in that spirit. :) I'll try to write about
some other stuff soon... though honestly my life is pretty
simple these days: toddler, cooking, fun coding, and
reading. For reading I am going to finish my book after I
finish writing this. The current book is The Dark Forest,
the second book in the Remembrance of Earth's Past series
(after "The Three Body Problem"). I had resisted reading
these books, but was convinced by a friend to give them a
try and I am glad I did. I have found them to be really
enjoyable so far. They remind me in many ways of Arthur C.
Clarke's work... though maybe more modernized in their style
and a bit less hopeful that Clarke's best stuff? Either way:
there is a good mix of hard sci-fi and more fantastical
stuff in them. Also some cool history stuff.

Have a good night gopherspace. I dont write much to you, or
to gemini for that matter, these days... but I am here and
I read your writings each day!