IRC channel logs

2020-11-05.log

back to list of logs

<daviid>I am going to add the traditional 'hello world' example the g-golf user manual, which I pasted here a few times, but the guile/g-golf code I pasted is some what a more complete version then those exposed at https://gtk.org/, the python code for example - which I could entirely 'mimic', if I wanted to 'compete' for the none less traditional 'contest' for the minimum number of lines of code, maybe - but even though, I have a question for
<daviid>a pythonist
<daviid>this python code, at https://gtk.org/, does not have a #!shebang ... so do i understand correctly that a python user could paste the code in a pythobn repl, but how would a python user drop the code in a file, chmod a+x and ./hello-world.py, what would be the missing lines to ne added if someone wanted to do that? pure curioisity, just to compare with our
<daviid>#! /bin/sh\n# -*- mode: scheme; coding: utf-8 -*-\nexec guile -e main -s "$0" "$@"\n!#
<wleslie>#!/usr/bin/env python
<daviid>wleslie: and what about the entry point, would the python code have to be changed to have a main function?
<daviid>the entry pojnt and command line args
<wleslie>to meet common code standards, you could put the last line in an `if __name__ == '__main__':` block
<daviid>wleslie: ok, thanks
<wleslie>if you want to accept command line arguments you'll need to import sys; which makes them available at `sys.argv`
<daviid>wleslie: although i prob won't be able to tun it here, could you kindely complete this snispet for me, so it does have an entry poin t and honour comannd line args ... if it's ok for you of course - https://paste.debian.net/1170009/
<wleslie>what do you want to do with the arguments?
<daviid>wleslie: nothing, just printf, or maybe passing the 'hello world' string so - just curious to compare with guile ...
<daviid>wleslie: the important thing is I'd be able to conpare, but i a a real example, those args would be passed to the run procedure,
<daviid>wleslie: in a real app, a real gtk app, the call would be
<daviid>(run (length args) args), args beig the command line args
<daviid>wleslie: here is the scheme code - https://paste.debian.net/1170010/
<daviid>the entry point is main (as you know), the args processing is on the last line ...
<wleslie>here's how I'd change it as a start https://paste.debian.net/1170011/
<wleslie>you can access sys.argv within the function of course but that's not really good practice
<daviid>wleslie: ok, many thanks
<wleslie>no worries
<daviid>wleslie: just for info, one can not change the on_activate arg list (nor any signal arg list), so i guess the correct thing you be to change the last line to call
<daviid>app.run('length'sys.argv[1:], sys.argv[1:]) - what ever would be the right syntax in python ...
<daviid>wleslie: but that is a detail, thanks again, now I can compare and make usefull comments in my g-golf manual ...
<wleslie>daviid: that's why I used connect_data, which I found using help()
<daviid>ah ok, i missed that change, great!
<daviid>I also can entirely 'mimic' the python code, without any decoration, box, label, shebang, entry point and arg processing, and even ask the gnome teram to post it at https://gtk.org/
<wleslie>lists know their length, so there's no equivalent to argc
<wleslie>sounds good
<daviid>wleslie: ok great - I could do that in scheme as well, but had so many other more important things to so that I did stick to the original args for those gtk-init, clutter-init, g-appication-run ... maybe for 2.0 :)
<wleslie>the never-ending fun of adapting APIs to a different paradigm
<wleslie>I have a python library that wraps the libfirm C compiler backend and just kind of hand-waves away the fact that the underlying C library uses global variables for a bunch of state
<daviid>wleslie: agreed, the only effort I wanted to and did dedicate wrt 'subject', while working on g-golf, is to 'hide' GValue initialization, because it really is difficult for users to 'do that' ... with time, I may also dedicate a bit of time to auto list length, but not know and not in the near future ...
<chrislck>\o/ hello-world.scsm
<civodul>hi!
<wingo>o/
<takside>hey there, anybody have experience with guile pipes or gnutls that would mind clarifying a couple of things?
***taw10_ is now known as taw10
<dsmith-work>{appropriate time} Greetings, Guilers
<mwette>howdy
***hugh_marera_ is now known as hugh_marera
<manumanumanu>stis: Hej!
<daviid>procrast time :) - I have a hello-world minimal example 'style' related quiz, if I succeed to get it on https://gtk.org/, let me paste
<daviid>here https://paste.gnome.org/pls21g4aq - would you prefer to publish as it is, or remove 12 to 14 and uncomment 16 ...?
<daviid>also, for the language of your choice, would you prefer I ask for "Guile" or "Guile Scheme"?
<str1ngs>daviid: use 12 and 14 and guile scheme. imho
<daviid>str1ngs: ok tx, anybody else has an opinionated opinion on this exesitential vital quiz :)?
<manumanumanu>I agree with str1ngs, but I know nothing about GTK.
<manumanumanu>but comment the sexpr properly with ;;. Not even the syntax-highlighter likes sexpr comments.
<daviid>manumanumanu: ok, tx for your opinion, wrt the commented code, I actually will remove it, justadded to ask here ...
<leoprikler>daviid: "Guile Scheme"
<leoprikler>I think you might want to present both variants in slightly different contexts.
<leoprikler>(run (let ())) is closer to Scheme, but (let () (run)) is closer to Gtk
<daviid>leoprikler: ok - to ask the gnome team to publish the example on https://gtk.org/, I'll keep one variant only, it really is 'just' an invitation to search/read about Guile and G-Golf - in the G-Golf manual, I will present it and other examples in a more complete and 'realistic' manner, as well as how one should build a real app ...
<daviid>I'll justr add some comments, just like they did for the python code ...
<leoprikler>Okay, then the latter so as to keep with their style
<leoprikler>i.e. (let () (run))
<daviid>ok, you all agree for "Guile Scheme" and the launch using the code as lines 12 - 14, so I'll do that, tx