IRC channel logs

2015-05-22.log

back to list of logs

<paroneayea>got an e-reader and put replicant on it
<paroneayea>now I'm making my way through The Lambda Papers :)
<davexunit>whoa, there is going to be foreign struct support 2.0.12?
<davexunit>am I just misreading something or did a new feature slip into stable-2.0 that I wasn't aware of?
<davexunit>I think it's a brand new API, and I'm excited for it. :)
<davexunit>hmm, I don't think foreign objects do what I was hoping they would.
<davexunit>it's a smob replacement. I was hoping it was a way to wrap C structs in Scheme.
<davexunit>like (struct (int foo) (* bar) (double baz))
<please_help>? There's already a mechanism for that
<please_help>davexunit https://www.gnu.org/software/guile/manual/html_node/Foreign-Structs.html
<nalaginrut>morning guilers~
<please_help>can everyone use the sneak bot?
<nalaginrut>please_help: yes
<please_help>sneak: later tell davexunit is this what you're looking for? https://www.gnu.org/software/guile/manual/html_node/Foreign-Structs.html
<sneek>Will do.
<please_help>(define x (%delay 3)) (+ x x) ; where delay is "some" delay function (delay macro or otherwise) ;; is there a way to make this work by modifying %delay or 3 but not +?
<nalaginrut>please_help: maybe you need method overloading here
<please_help>rather I'd like if every access to "x" actually evaluated to (magic-function x) throughout the program
<nalaginrut>hmm...I guess unless you modify the compiler...
<please_help>method overloading is not feasible in this case because rather than +, every single function that exists or will exist that accept "3" as their argument has to work fine also if passed x rather than "3".
<nalaginrut>if you really don't want to overload +
<please_help>conditional on my providing a method that maps "x-types" to "3", so to speak
<please_help>a (%force) by analogy
<nalaginrut>alas~I prefer write a new macro 'plus' rather than play delay game...
<mark_weaver>please_help: almost(?) all of our numerical operations can be overloaded to support new numeric types, using 'add-method' from GOOPS. I used it long ago to implement arbitrary precision real and complex numbers, although I've not yet published that code. that's the only thing I can offer that does approximately what you're asking for.
***michel_mno_afk is now known as michel_mno
<ArneBab_>please_help: do I understand it correctly that you want something like a property in python? → getters and setters
<ArneBab_>?
<civodul>Hello Guilers!
<ArneBab_>moin moin ☺
<please_help>ArneBab_ if you mean @property decoration, kinda, yes.
<ArneBab_>please_help: that’s something I’d like to see, too. It makes it very easy to define simple data APIs which can get getters and setters later.
<ArneBab_>please_help: maybe you can instead of defining x define a datastructure from which you access x.
<ArneBab_>something like a class
<ArneBab_>to scale this up you could then change the accessor
<ArneBab_>please_help: you could create a macro which rewrites every instance of x to (get-property 'x)
<ArneBab_>and then do (define x (%delay 3)) (with-property x (+ x x))
<ArneBab_>please_help: or simpler: make x a procedure and add a macro which calls every x
<ArneBab_>(x) → value of x
<ArneBab_>(x value) → set x
<please_help>that would defeat the point of the endeavor, though.
<please_help>at this point there would no longer be transparency, might as well just define a record and define every relevant op on it
<ijp>there are identifier macros, but I'd avoid them if possible
<ArneBab_>please_help: hm, yes…
<ArneBab_>ijp: why?
<please_help>identifier macros wouldn't work "well-enough" either because they can't replace reader-syntax expressions
<ijp`>bah
<ijp`>same reason as normal macros
<ijp`>I can't even remember the last time I used one for serious purposes
<ArneBab_>ijp: what’s your reason for avoiding normal macros?
<ijp>firstly, it's partially an overreaction to the overuse of macros by new lispers
<ijp>secondly, macros are more annoying to write and debug than normal functions
<ijp>thirdly, they are more annoying to *test*, and most macros written are poorly tested
<ArneBab_>sounds very sensible to me. When would you use a macro?
<ijp>trivial sugar is excepted from all this
<ijp>"I know when I see it"
<ArneBab_>damn… so it comes down to experience and “cut your own fingers often enough, then you’ll know it, too”
<ijp>boilerplate removal, and control are two general classes of when to use a macro (but the latter can often be done just as nicely with functions + trivial sugar)
<ijp>any rule I give you is going to come with N mutually contradictory caveats
<mario-goulart>ArneBab_: isn't what you want something like http://wiki.call-cc.org/eggref/4/callable-data-structures ?
<ArneBab_>ijp: ok - still thanks!
<ArneBab_>mario-goulart: what I (and please_help) want is a datastructure which calls a function when it is used or gets assigned a new value
<ArneBab_>transparently
<ArneBab_>⇒ define an API for accessing some data. Start with simple variable access, but have the option to add getter and setter later.
<ArneBab_>(use-module (foo) #:prefix foo-) (write foo-N) (set! foo-N -1) ; ← error! N must be ≥ 0!
<ArneBab_>mario-goulart: I had thought that callable datastructures could be a good basis for implementing this.
<ArneBab_>essentially it’s about hiding that a function gets called when someone accesses a variable
<mario-goulart>Maybe srfi-39 parameters with a converter procedure would also do the trick.
<ijp>applicable structs are in guile, as are custom setters
<ijp>and integrated into goops, if for some reason you want that
<paroneayea>hello, *!
<ArneBab_>Do I I understand it correctly that all of these have to be called? (not just accessed)
<ArneBab_>hi paroneayea
<ijp>basically
<mario-goulart>ArneBab_: in the cases of callable-data-structures and srfi-39 parameters, yes.
<ArneBab_>ijp: in that case they would make an API more complex than needed for a simple example: “to read our values, you have to call the accessor-functions”
<ijp>(frob foo) and (set! (frob foo) wibble)
<ArneBab_>instead of just “these are the variables with the data”
<ArneBab_>identifier-macros look like they would provide the feature: foo → (foo); (set! foo "bar") → (foo "bar")
<ArneBab_>but that they don’t play nicely with reader-syntax is non-nice
<ijp>reader modification is a sin
<mario-goulart>:-)
<ArneBab_>reader modifications is necessary to implement other languages
<ArneBab_>(oh, well, logically that means that other languages are a sin ☺)
<ijp>no, a different reader is needed
<ArneBab_>what about curly-infix from SRFI-105?
<ijp>fifth amendment applies here
<ArneBab_>that’s very useful to make mathematical code more readable
<ijp>but suffice to say I've been against "readable" for a long time
<ArneBab_>bad choice of naming from my side: I meant “approachable for non-schemers”
<ArneBab_>when I showed a collegue some code I wrote, the first thing he said was “prefix math is ugly!”
<ijp>I'm saying no more about this topic
<ArneBab_>ok
<ArneBab_>thanks for cutting the flammable material before it erupts ☺
<ArneBab_>I just found out the hard way that “please_help: does not work with reader-syntax expressions” means that I cannot use variable-transformers in wisp
<ArneBab_>but they work in plain scheme
<taylanub>ijp: I dislike readable and the likes too but SRFI-105 is neat really
<please_help>Being able to wrap data so it can make use of any function available to the wrapped type transparently without future code having to know about you would simplify a lot of things, including inter-system/inter-device communication.
<ArneBab_>please_help: thank you for asking the question here! This just removed one of the questions I had about scaling in py2guile!
<please_help>;)
<ArneBab_>“identifier-syntax: getters and setters for variables”
<ArneBab_>ijp: thank you for mentioning identifier-macros!
<ArneBab_>cu
<dsmith-work>Happy Friday, Guilers!!
<artyom-poptsov>Happy friday to you too, dsmith-work
<civodul>yay, happy Friday!
*sneek dances
***michel_mno is now known as michel_mno_afk
<paroneayea>davexunit: installing haunt, mainly because I'm going to study it to understand how you're doing web stuff with guile ;)
<stis>cheers guilers!
<paroneayea>monads in sxml!
<paroneayea>I can't escape learning them! ;)
<davexunit>paroneayea: :)
<stis>i'm back!
<stis>yey, I just implemented a forẃard chaining lib in my prolog
<stis>works like a beuty!