Search
Sunday, 15th of January 2023, 19:59:27 UTC
19:59:53
jackdaniel
it may not be seen in the example I gave, but the defpackage in there will have :export clause with all defined symbols
20:00:28
atgreen
I am cheating right now and referencing them all with "::"
20:00:31
jackdaniel
so if something acesses clx.xcb-proto.xproto:rectangle, then both package and the symbol will be present
20:00:33
atgreen
so I don't have to export
20:01:07
jackdaniel
I see, that's another way (but you still need a foo package to be created)
20:02:45
atgreen
very basic stuff is working... I just want to change how code is emitted so it is nicely formatted
20:03:32
jackdaniel
I'm not very experienced with pretty printer but I've found it very nice with tasks I'm doing (both with generating common lisp and c99 code)
20:04:01
atgreen
Is there some way I can disable CL's handling of : while it reads?
20:05:51
jackdaniel
you may define your own read table and replace the reader macro character :
20:06:09
jackdaniel
then when you read the file, use the alternative read-table
20:16:18
atgreen
is is a macro character?
20:16:20
atgreen
cl-user> (get-macro-character #\')
20:16:20
atgreen
#<function sb-impl::read-quote>
20:16:20
atgreen
cl-user> (get-macro-character #\:)
20:18:12
jackdaniel
it is probably part of the symbol reader, but if you make #\: a macro that is not constitudent then you will read two symbols
20:18:16
jackdaniel
but that's probably not what you want
20:18:48
jackdaniel
and replacing the symbol reader would be a tad more invovled
20:21:38
atgreen
it doesn't seem like this is going to work :(
20:22:12
atgreen
maybe formatting the code with an external process (emacs) would be better
20:22:43
jackdaniel
but why can't you define the package with appropriate exports? or put a double colon?
20:23:13
jackdaniel
hacking a reader is fun but it seems more like a kludge than a solution
20:23:25
atgreen
I don't want to define packages a transpile-time
20:23:36
atgreen
I just want to generate code
20:24:21
jackdaniel
but in that case you don't need to read it
20:24:35
jackdaniel
and there is no problem in the first place - am I wrong?
20:26:29
atgreen
well, I'm generating it as a string right now
20:27:41
atgreen
so I would have to read the string in order to pretty print it
20:28:43
jackdaniel
you have a common lisp code (as text) that you want to print as a common lisp code?
20:29:37
jackdaniel
I thougth that you have some ast representation that you want to print as common lisp (like me :)
20:33:02
atgreen
I'm generating CL source code from an AST. I'm going to try this: https://github.com/yitzchak/cl-indentify
4:10:27
beach
atgreen: If you use Eclector to read your code, you can customize the symbol reader function.
Monday, 16th of January 2023, 7:59:27 UTC