Background:
Since Spritely has inspired me to repent and join the right path of computing, I’ve been rapidly learning and assimilating the Guile way of doing things. I’m running Guix on my desktop with Emacs (not Guile Emacs yet though) as my DE. I’ve started writing some crazy distributed-state code with Goblins and converting all my config into literate org files.
I’ve read the excellent Spritely Scheme Primer, as well as plenty of intro-level books and articles on various other lisps (my favourites are pig’s On Lisp, and The Little Schemer). I have lots of experience with other kinds of languages in various contexts, and have been a professional programmer for many years. I don’t say this to boast. I say it because it gave me an expectation that I would have an easier time learning.
Problem:
When I look at a piece of Guile code I find it very hard to know what’s going on. I know familiarity Congress with time and practice, but I feel like I’m missing something. In C there’s usually few enough libraries and tricks that I can easily spot unfamiliar imported functions and guess what they’re doing. In Haskell I use the type system and Hoogle to tell me what to expect and then I can use typed holes or the REPL to check my intuition. Even in Python every imported object will either have a namespace or explicit import in the same file, and I can use dir
and help
to inspect objects to see what’s possible and what I’m expected to do with them.
I don’t have this power (yet) in Guile. I see a symbol and apart from its name I don’t have any information about it. Is it defined yet? What’s in that definition? If it’s a function what arguments can it take? If it’s an object what members does it have? If I can’t see where it was bound (use-module #:select
or let
or define
etc.) then how can I know where it came from?
Presumably all experienced Guile programmers have overcome this and have the familiarity to recognize common things, and reliable methods to quickly find out about unfamiliar things. I think my problem is that this is not present in introductory material, which focusses on basic examples and syntax, and is more likely just “common knowledge” that’s learnt from discussions and hard work.
Question (and tl;dr):
When you see (foo (bar #:baz quux))
in a piece of code, and you can’t tell what those symbols refer to, what do you do? (I can guess that maybe quux is local, baz is a keyword specific to bar and foo is some function related to baz’s output type, but that’s all.)
Does everyone use some handy geiser/lsp setup that integrates documentation and local definitions? Do you just grep your source folder? Do you spend years memorizing ice-9?
I know there’s no single answer, but I’d love to know what you working, productive Guile programmers do and how I can make my learning journey less bewildering.
Thanks, and please excuse for the excessively long post.