IRC channel logs


back to list of logs

<apteryx>sneek: later tell mwette thanks, but it seems the source file metadata inherits that of an included file, e.g.:
<sneek>Got it.
<old>hey so I was toying with the ecmascript language yesterday for fun
<old>I wonder how does one access invalid binding when using this language?
<old>For example: for-each is invalid ecmascript symbol, so it is not possible to use such binding in that language? One would have to make wrapper or alias?
<apteryx>you'd have to use elisp loops construct, no? I doubt you can fuse both languages in one compilation unit?
<drakonis>relevant to guile in wasm
<old>apteryx: ecmascript is javascript
<apteryx>uh, not sure why I confused both. is there no for-each in js ?
<old>the `-' is invalid for identifier in js
<old>So I just wonder, how does one can use a language over the Guile VM if most bindings are invalid
<old>I assume that one has to make alias that are valid in the targeted language
<old>and wrappers
<old>but what about syntax transformers then? For example I can do: require("ice-9.match"); to get (ice-9 match) in JS
<old>But I can not use the match syntax
<old>I guess that make sens for syntax, but for procedures, a rename would probably be needed
<apteryx>first step of fixing bug #66046: turn scm_i_relativize_path into a public API
<apteryx>hm: ;;; generated 2002-05-12 05:25:39 UTC by scan-api -- do not edit!
<apteryx>it's been 20 years since and people are manually editing that file, according to git log. Is there no scan-api tool around anymore?
<apteryx>it's at: scripts/scan-api.scm
<apteryx>old: if you get the hang of it, a blog post would be useful!
<apteryx>I doubt many hackers are dabbling with the language tower of Guile
<old>apteryx: and yet, I see benefit of having a frontend for Python and Lua for example
<old>Write in Guile and let the users use your tools in their favorite language
<apteryx>yes; there is clearly a benefit. not sure how well it works in practice though.
<apteryx>so I'm curious about your experiments :-)
<apteryx>how can I use guile -e and -s switches along with #!/usr/bin/env -S guile ... in the shebang?
<apteryx>ah, I think there's an undocumented subtlety when using -e with a define-module
<apteryx>the variable is in the module namespace, so you have to use -e '(@ (the module) variable)', IIrc
<apteryx>so this nearly works in my case: /usr/bin/env -S guile -e '(@ (scripts scan-api) scan-api)' -s
<apteryx>with !# on the 2nd line
<apteryx>cool, that script still works
<sneek>Welcome back mwette, you have 1 message!
<sneek>mwette, apteryx says: thanks, but it seems the source file metadata inherits that of an included file, e.g.:
<mwette>I have generated a lot for javascript, matlab, tcl; was stuck trying to deal with multi-lang object system
<mwette>see nyacc on
<old>mwette: what's the nx-* langs?
<mwette> "nx" == "nyacc extension": language based on nyacc
<mwette>"nx" == "not exactly" : language is not exactly what the name implies
<old>and how you would go to do something like this in javascript?:
<mwette>for example, numbers in javascript/emcascript are odd, and strings are not compatible with guile
<old>(module-for-each (lambda (binding value) (display binding) (newline)) (resolve-interface '(ice-9 control)))
<old>my guess is that I should do a: (define (list_module_symbols) (module-for-each (lambda (binding value) (display binding) (newline)) (resolve-interface '(ice-9 control)))))
<old>then in javascript I can do: list_module_symbols();
<mwette>If a name is of the form abc_def and not found, nx-compilers will try abc-def
<old>but I cannot directly call module-for-each, nor create lambda in javascript?
<old>oh sweet
<mwette>no, lambda is not javascript, but javascript has closures
<old>right function() {}
<old>is like lambda
<apteryx>I have an error from my modified scm_relativize_path procedure: fports.c:143:13: error: too few arguments to function 'scm_relativize_path'
<apteryx> 83 | SCM_API SCM scm_relativize_path (SCM path, SCM load_path);
<apteryx>the second argument is defined as optional in the associated SCM_DEFINE
<apteryx>the SCM_DEFINE looks like: SCM_DEFINE (scm_relativize_path, "relativize-path", 1, 1, 0, (SCM path, SCM load_path), "docstring")
<mwette>scm_relative_path(path, SCM_UNDEFINED) IIRC
<apteryx>I based it on scm_basename, which accepts an optional arg
<apteryx>which reads: SCM_DEFINE (scm_basename, "basename", 1, 1, 0, (SCM filename, SCM suffix), "docstring")
<mwette>calling from scheme or C?
<apteryx>calling it fails when called from C
<apteryx>more context:
<mwette>you want scm_xxxf(filename, SCM_UNDEFINED)
<apteryx>does that mean that scm_basename is not defined correctly for use in C?
<mwette>C does not have optional args (well, variadic args, but that doesn't count)
<apteryx>also, we have: SCM_DEFINE (scm_stat, "stat", 1, 1, 0, (SCM object, SCM exception_on_error), ...)
<apteryx>seems this pattern should work?
<apteryx>also, does someone know what snarfing means in the context of Guile? e.g., snarfing docs is the SCM_DEFINE_GSUBR
<apteryx>ah, info "(guile) Function Snarfing"
<apteryx>mwette: ah, you meant at the call site
<apteryx>silly me
<apteryx>is scm_canonicalize_path the same as canonicalize_file_name in C?
<apteryx>canonicalize_file_name being provided by libc
<apteryx>yes, it's the same per filesys.c
<apteryx>mwette: I'm now interested in the reverse for the source reference in the .go: how/where is it written? I'm looking at read-and-compile and compile at the moment
<apteryx>I don't understand how 'compile1' comes into existance in read-and-compile; it is initialized to #f, and never passed to anything else in the named let
<apteryx>*passed as anything else
<dsmith>apteryx, There are two snarfing systems. For C and Scheme. The C one uses the preprocessor and a C prog to generate the help text files.
<dsmith>apteryx, SCM_DEFINE is defined one way for compiling the file, and a different way for extracting the help text
<apteryx>is the the Guile C procedures documention supposed to be automatically generated?
<apteryx>e.g. scm_basename is SCM_DEFINE'd with docstring, but I don't see how that's automatically sarfed and assembled into the doc/ref/posix.texi file
<apteryx>ah regarding my compile1 question earlier, its value is computed via compute-compiler circa line 360 of compile.scm
<dsmith>apteryx, In libguile/, look at the targets: .c.doc, guile.texi, guile-procedures.texi, dotdoc2texi, and snarf2checkedtexi
<dsmith>Also guile_filter_doc_snarfage