IRC channel logs


back to list of logs

<str1ngs>alextee[m]: SCM_MAGIC_SNARFER is only used to avoid .x files that don't exist.
<str1ngs>alextee[m]: see
<str1ngs>alextee[m]: only wrap it around .x includes not C headers
<str1ngs>alextee[m]: also make sure you don't have any manual scm_c_define_gsubr
<str1ngs>rekado_: do you know if it's possible to call scheme code from elisp?
*guix-vits Hi there; "afk"
<manumanumanu>Good morning, guilers!
<alextee[m]>str1ngs: i still get a bunch of these
<alextee[m]>with this C file
<alextee[m]>and this call to guile-snarf
<alextee[m]>for some reason it's including time.h twice, i thought that was not possible because there should be a header guard
<alextee[m]>is there any benefit of doing scm_make_foreign_object_type for each type other than just having a single generic object type (assuming i only store a pointer to the underlying struct inside it)? is it used only for type checking?
<alextee[m]>i already can do type checking in my C code so I'm just wondering if i should only make a generic foreign object type for my app and re-use it
<alextee[m]>s/other than/rather than
<mwette>You can do (foo? obj), and write will show you what you have.
<mwette>looking at my stuff. foo? does not come for free I guess
<mwette>D you have a predicate to indicate a value is your object type?
<alextee[m]>not sure what you mean but my C structs have magic numbers to identify them
<alextee[m]>also works with my polymorphism (the main reason i think scm_make_foreign_object_type() would cause me problems)
<alextee[m]>for example a "region" is also an "arranger_object" in my C code, so if i use scm_make_foreign_object_type() i think this would not know that "region" is also an "arranger_object"
<mwette>that's what I mean. So you should write a c function that can be called from Scheme as (foo? obj)
<mwette>where foo is the name you use for the type
<alextee[m]>should, not must i guess :-) i can probably skip this
<alextee[m]>(or do it later)
<chrislck>always nice to see a guile convert :D
<srandon111>guys why the docs of guile suck so much??
<srandon111>i was searching how to do exceptions... and i didn't find half example of code
<srandon111>and it's not the only case... i think they need a serious revisitation with examples of code here and there
***rekado_ is now known as rekado
<str1ngs>alextee[m]: do you have glibc installed to your GUIX_PROFILE?
<alextee[m]>str1ngs: yes, `guix package --list-installed=glibc` lists it
<str1ngs>alextee[m]: I don't think that's advisable. you should only need gcc-toolchain
<alextee[m]>what about glibc-locales?
<str1ngs>locales is fine
<str1ngs>alextee[m]: and all your headers have guards for sure?
<alextee[m]>let me check
<alextee[m]>time.h does
<alextee[m]>let me check my own headers too
<alextee[m]>yeah they do. i'd get compilation errors if they didn't
<alextee[m]>i mean when compiling without snarfing
<alextee[m]>if you're willing to debug it i can guide you to build the software so you can see for yourself all the headers and the x file contents and whatnot
<alextee[m]>actually it's pretty easy if you're on guix :-)
<str1ngs>it's more then likely the glibc installed to GUIX_PROFILE. but if you link the git repo I can check it out.
<str1ngs>alextee[m]: your types are not GObjects right?
<alextee[m]>`guix environment --ad-hoc zrythm` so you have all the dependencies, then wget
<alextee[m]>str1ngs: no
<str1ngs>which branch? I prefer git for this.
<alextee[m]>oh, bugfixes branch
<alextee[m]>that's the clone link
<str1ngs>okay will check it out.
<alextee[m]>to build: meson build && ninja -C build. then try to edit src/guile/audio/position.c by adding #include "audio_position.x" in init_module () to see all the errors
<alextee[m]>the .x file is generated in build/src/audio_position.x
<str1ngs>alextee[m]: I don't get the include errors using. guix environment zrythm --ad-hoc guile gtksourceview
<str1ngs>alextee[m]: did you try removing glibc?
<alextee[m]>really? can you post the contents of position.c ?
<str1ngs>zrythm won't launch becaues it can't find settings scheme. which is probably okay
<alextee[m]>yeah that's normal
<alextee[m]>let me try. i think i haven't retried since i removed glibc
<str1ngs>the guile position.c or audio?
<alextee[m]>this is src/audio/position.c
<str1ngs>sorry you wanted guile one sec
<alextee[m]>sry it's confusing :) i made the guile/ stuff mirror what's in src
<alextee[m]>str1ngs: where did you include the x file?
<str1ngs>I did'nt include anything. I assumed you had added this.
<alextee[m]>that's without the .x file. i can send a patch to include it if you want, but it's just a matter of replacing lines 106- 109 with #include "audio_tracklist.x" wrapped inside an ifndef SCM_MAGIC_SNARFER
<alextee[m]>doesn't build here after i removed glibc
<str1ngs>also I have to export CC=gcc lol
<alextee[m]>oh right the environment doesn't have CC
<alextee[m]>is the .x file supposed to be 10k lines long?
<str1ngs>first off. does guile-snarf-wrap.scm generate the x file?
<alextee[m]>i think the problem is that it unwinds every included file somehow. i see a bunch of declarations for guile functions
<alextee[m]>in build/
<str1ngs>what is guile-snarf-wrap.scm I've never seen this before
<str1ngs>I've only used. guile-snarf -o $@ $< $(snarfcppopts)
<alextee[m]>that's exactly what it does
<alextee[m]>it does this: guile-snarf -I<the libguile include path> -o <xfile path> <input C file path>
<str1ngs>I'm not getting the point of this. why not just use meson to call guile-snarf
<alextee[m]>because i need to call pkg-config --cflags and i can't easily do that in meson
<alextee[m]>so i wrapped the call there
<str1ngs>but meson should build a CFLAGS or something no?
<str1ngs>I think you need to remove the -I libguile.h
<alextee[m]>it does internally, no way to get it
<str1ngs>can you spin off a branch and push what you have there.
<str1ngs>because I'm getting similar errors now, but not the same
<str1ngs>there must be a way to get the cflgs
<str1ngs>err cflags
<alextee[m]>there is not afaik :/ but there is a way to get the pkg-cofnig names, which i can pass to the wrapper and do pkg-config --cflags on them
<alextee[m]>which i tried before but still had problems
<alextee[m]>all the headers should be available when in snarf mode?
<alextee[m]>and i need to pass all the required -I flags so they get found, right?
<str1ngs>alextee[m]: right but libguile.h should have a pgkconfig cflags so it might be included twice.
<str1ngs>but for me to look at this i need to have what you have there. push a temp branch or something.
<alextee[m]>ok let me add all those flags first
<str1ngs>leave it as is for now. just need to be on the same page
<anadon>Hello all, I'm learning Guile and was looking about maybe supporting OCaml as well. Is this feasible, or is there some bijection between the languages?
<rekado>what do you mean by “supporting OCaml”? OCaml and Guile are very different languages.
<mwette>anadon: are you talking about using the Guile backend to compile OCaml source and be able to access data both from Scheme and OCaml?
<jcowan>Sure it can be done, it's what's known (sarcastically) as a Small Matter of Programming. As in making your C compiler also compile Scheme.
<jcowan>No blame to you, but we do get a lot of posts of the form "I'm a Guile n00b and I want to do <something very difficult>." Try walking before you run.
<alextee[m]>str1ngs: just pushed to a branch called "snarf"
<str1ngs>alextee[m]: thanks
<alextee[m]>i'll start adding the cflags now and remove the #if !defined(SCM_MAGIC_SNARFER) from the headers
<str1ngs>alextee[m]: this x files look wrong
<anadon>jcowan: Hey, I ask because I'm new. I don't quite know what's stupid yet here.
<dsmith>alextee[m]: Not sure if it will help, but take a look at
<jcowan>As I say, no blame to you for asking.
<anadon>mwette: Just reading on the Lisp lineage and ondering if there was a significant overlap in working syntax and features.
<jcowan>But seriously, if you were new at <whatever language X you know>, would you try to write a <language Y> to <language X> translator?
<jcowan>Syntax, no, but it's semantics that matters. Common Lisp and Scheme almost share syntax, but the deep differences are in semantics.
<jcowan>OCaml and Scheme have very different syntax *and* semantics.
<alextee[m]>str1ngs: i thought so. can you pls post a correct looking x file? i have no idea what it should look like, but i would guess it would not include function declarations
<alextee[m]>dsmith: thanks!
<str1ngs>alextee[m]: should look more like this.
<jcowan>dsmith: That project appears to be empty, unless I am doing something wrong (I don't use the gitlab UI much)
<alextee[m]>dsmith: there is nothing there
<anadon>jcowan: I'm trying to write a paper to rework for files are funamentally thought of and treated. So I do have a number of years of formal programming experience in C-like languages. I'm just branching out to more "pure" languages and trying to architect things before I spin out and sink a bunch of time into a dead end. So the Lisp family of languages looks like a correct choice, but I'm not yet familiar with them deeply enough to avoid
<anadon> dumb things.
<alextee[m]>str1ngs: !!!!! yes! i thought so. i have no idea why my x file is 10k lines long and includes the whole of libguile.h
<dsmith>alextee[m]: Hmm.
<str1ngs>alextee[m]: guile-snarf is not being invoked properly
<str1ngs>as far as I can tell
<jcowan>Okay. Be aware that the Lisps, ML, and OCaml are all impure functional languages. Haskell is pretty much the only pure functional language still standing.
<mwette>anadon: Good luck. Like jcowan said, pick one and go. SML and Haskell are others that probably have more similar syntax. Though the semantics can be very different. (IIRC Haskell has lazy eval.)
<alextee[m]>so `guile-snarf -I... -I... ... -o output.x input.c` is incorrect? i see you used a pipe before str1ngs
<jcowan>Do you have a draft or outline of this paper you can put on line? I've been interesting in file systems for a while now.
<jcowan>"Haskell is lazy to preserve purity, and it is pure because we likes pure, we likes it, gollum!"
<str1ngs>alextee[m]: think I fixed it
*jcowan thinks that a language should not be lazy and do strictness analysis for efficiency, but be strict and do laziness analysis when the procedure is marked pure.
<alextee[m]>str1ngs: I tried this from the root dir, still makes a 10k line .x file: `guile-snarf -I. -Iinc -I$(pkg-config --cflags gtk+-3.0) -I$(pkg-config --cflags guile-2.2) -o test.x src/guile/audio/position.c`
<alextee[m]>str1ngs: :o
<jcowan>Of course "purity" is only meaningful at a specified level of abstraction: pure languages depend on decidedly impure allocators.
<alextee[m]>oops, -I is wrong
<alextee[m]>still 78k lines though with gtk
<alextee[m]>str1ngs: i did it!!
<str1ngs>alextee[m]: can you try with this patch
<str1ngs>alextee[m]: the input and output should come before CFLAGS
<alextee[m]>str1ngs: yes! i just figured that out while trying
<alextee[m]>isn't that a bug though?
<alextee[m]>i thought order of arguments didn't matter
<str1ngs>its' also documented guile-snarf -o out-file in-file. so I don't think that's a bug
<dsmith>alextee[m]: Ok, I think you can see the files now.
<str1ngs>alextee[m]: and this would be easier to support if you used autotools :)
<alextee[m]>str1ngs: lol
<str1ngs>I know the GTK people like meson. but use guile folks use autotools
<alextee[m]>it compiled now!
<dsmith>alextee[m]: fwiw, that's the sqlite interface that the bot has been using for ages
<alextee[m]>str1ngs: thanks so much for your help
<alextee[m]>dsmith: not needed anymore yay \o/
<str1ngs>alextee[m]: also for nomad I did not split the C files. I just add the SCM_DEFINE's lower in the main C file. it's less bookkeeping
<alextee[m]>what bot is using it though?
<dsmith>sneek: seen rlb?
<sneek>I last saw rlb on Apr 01 at 07:37 am UTC, saying: In any case, thanks for the help..
<dsmith>Stuff like that
<alextee[m]>str1ngs: you mean just include all the x files in a single go?
<alextee[m]>dsmith: oh that's awesome, i love sneek
<str1ngs>alextee[m]: no I mean instead of having two position.c files
<alextee[m]>str1ngs: i prefer to split the guile stuff from the main logic
<str1ngs>well it's using main logic anyways :) and it's in the same namespace
<alextee[m]>and apparently you don't need any extra cflags
<str1ngs>so this is just a book keeping issue :P
<alextee[m]>str1ngs: it works if you wrap all the headers except libguile in an #ifndef SCM_MAGIC_SNARFER
<alextee[m]>so you don't really need to pass any CFLAGS to guile-snarf
<alextee[m]>except guile's include path
<alextee[m]>which makes my life easier with meson since i won't have to bother collecting all those cflags
<str1ngs>again SCM_MAGIC_SNARFER should only wrap. dot X includes
<str1ngs>please read the snarfing documentation
<alextee[m]>but if it works on the headers too :P
<alextee[m]>i did, but i do not see why it needs to know what's included
<str1ngs>either way whatever works for you :)
<alextee[m]>:-) glad it's working now
<str1ngs>I'm not sure about foreign objects. need to think more on that one.
<alextee[m]>i think the benefit of using foreign objects is that their lifetime is managed by guile
<alextee[m]>i think?
<str1ngs>well as far as I can see the structs are now guile types
<str1ngs>which is usefully in your case, because most of your types are C
<str1ngs>in nomad I did the inversion most of the types were scheme. and I only used C for the GTK etc.
<alextee[m]>i am thinking to just make a single type and use it everywhere
<alextee[m]>since all the type really has is a pointer stored in a "data" location
<str1ngs>if your types where GObjects you can use guile-gi or g-golf :P
<str1ngs>and get introspection for free :)
<str1ngs>this is what I do with nomad nomw.
<str1ngs>alextee[m]: though snarfing is a good start.
<srandon111>guys can somebody tell me if there is a book about guile? i mean other than the reference manual which kind of sucks without offense
<str1ngs>srandon111: please provide more constructive criticism than it sucks.
<guix-vits>srandon111: try SICP book (guile is an implementation of scheme)?
<srandon111>guix-vits, i already read SICP
<srandon111>str1ngs, yees... it basically lacks examples.. i was trying to understand how to launch exceptions anc catch them... welll i see the dense TOC, go in the section and can't see half example of code
<srandon111>basically it seems some kind of memento for developers of guile
<srandon111>i think the manual needs some serious revisitation, especially inserting sometimes examples of code would be definitely helpful instead of being super abstract
<rekado>srandon111: no manual is ever perfect and the Guile manual does have a couple of spots that are hard to understand. When you have concrete issues with the manual please submit a bug report with a proposal for change (or even a patch).
<rekado>about exceptions: have you read the manual section on exceptions? It does have a few examples.
<str1ngs>srandon111: which version of guile are you using?
<rekado>and it has a lot of elucidating prose
<srandon111>rekado, a couple of spots???? damn everytime i need something i can't find half example of code dude
<srandon111>sorry for being rude... but let's say things as they are...
<srandon111>str1ngs, 3.0.2
<srandon111>rekado, can you link the examples?
<rlb>One thing that might eventually belong in the info pages if it's not, is the "plan" wrt exceptions that's in the 3.0 NEWS (I think).
<rlb>i.e. the intent to move away from throw/catch, etc.
<rlb>(i.e. guidance)
<srandon111>guys we need to improve those docs/manual
<rlb>no argument that the docs could be improved, someone just has to have the time to do the work, and understand what's needed.
<str1ngs>exceptions have changed in 3.0 could that be causing the confusion here?
<rlb>s/no argument/no doubt/
<str1ngs>myself I use guile 2.2 and the catch documentation is self explanatory IMHO
<str1ngs>provided you read the signature
<srandon111>str1ngs, i am not a guile developer nor a super skilled scheme dev
<srandon111>i need examples
<rekado>srandon111: I’m sure you can “say things as they are” without being rude. This will also make it more likely that people will assist you.
<str1ngs>I think the expectation here is a little off. It's guile reference manual. not guile by example
<rlb>I suspect srandon111's talking about even more descriptive examples for those newer to scheme, etc. I think the info pages do a very good job of that in some places, and could include a bit more "gentle introduction, elaboration" in others. No specific examples in mind right now though, but I think that's crossed my mind before.
<str1ngs>I'm wondering if the changes to exceptions that is confusing things here
*rlb too
<srandon111>str1ngs, in general not only exceptions
<srandon111>many other points...
<srandon111>anyway i am working on a tutorial right now
<rekado>str1ngs: no, there is no copy-paste-ready snippet that shows throw and catch.
<rlb>str1ngs: and yeah, I imagine what srandon111 would really like is a more introductory text, but in the absence of that, in cases where it doesn't detract, wouldn't hurt to elaborate in the info pages.
<rlb>(simple mater of texinfoing...)
<str1ngs>rekado: right guile 2.2 makes sense to me . the guile 3.0 does not. but that's just quickly trying to grok it on my part.
<srandon111>rekado, exactly
<srandon111>rlb, yes
<rekado>I do think “the manual sucks” is a very uncharitable way of viewing a lack of examples. The Exceptions section is very comprehensive and, I think, well written.
<str1ngs>I use R5RS to learn the basics of scheme.
<str1ngs>though I'm not sure if that's the issue here. there seems to be an expectation that a the reference manual should have examples. I think that more of a ideal situation then an expected one.
<anadon>dangling link from google when searching "guix upgrade" :
<str1ngs>anadon: maybe let #guix now
<anadon>Wrong tab!
<malaclyps>Is there a way to pop up to the top-level prompt in the Guile repl? I always end up 9 backtraces down and have to ",q" forever to escape
<srandon111>rekado, rlb e.g., where do i find the manual how to find help for a specific command?
<mwette>look in the index
<mwette>you can also type `,d proc' at the command prompt, where proc is the procedure (or function) you are interested in
<srandon111>mwette, where in the index?
<srandon111>where should i lok ?
<rekado>srandon111: if you’re using an info reader (such as “Emacs” or “pinfo” or “info”) you can hit “i” and type away.
<str1ngs>malaclyps: I'm not sure if this is the best way. ,finish twice works
<malaclyps>str1ngs, thanks
<str1ngs>malaclyps: not confident that is right I get. system/vm/trap-state.scm:253:16: Wrong number of arguments to #<procedure 5640ee834300 at system/vm/trap-state.scm:253:16 (frame)>
<str1ngs>but works on the second attempt
<malaclyps>str1ngs, yeah, it quits scheme on my first try, but maybe it's a clue to the right thing to do