sionescu / iolib

Common Lisp I/O library
http://common-lisp.net/project/iolib/
MIT License
141 stars 31 forks source link

How to use the reader? #65

Open Ambrevar opened 3 years ago

Ambrevar commented 3 years ago
> (in-package :iolib/pathnames)
> (iolib/base:enable-literal-reader* )
T
> #/p/"README.org"
#/P/"README.org"
> #/p/"README.org"
; error
> (iolib/pathnames:file-path "README.org")
#/IOLIB/PATHNAMES:P/"README.org"
> #/IOLIB/PATHNAMES:P/"README.org"
; error

Some things be wrong.

Thoughts?

sionescu commented 3 years ago

It works in any package that imports the symbol iolib/pathnames:p.

Is it intended that the reader dispatch string changes?

I'm not sure what you mean by this.

Why surround the reader dispatch string with /

I meant the #/ macro to be something generic that I could reuse. It currently works for IP addresses: #/ip/1.2.3.4 or #/ip/ff::1.

Ambrevar commented 3 years ago

It works in any package that imports the symbol iolib/pathnames:p.

OK, (import 'iolib/pathnames:p) did the trick. Maybe document it?

Is it intended that the reader dispatch string changes?

I'm not sure what you mean by this.

If you don't import the iolib/pathnames:p symbol, then the object is printed as above in #/IOLIB/PATHNAMES:P/"README.org".

This is not cl:read-able by the way. Bug then?

Why surround the reader dispatch string with /

I meant the #/ macro to be something generic that I could reuse. It currently works for IP addresses: #/ip/1.2.3.4 or #/ip/ff::1.

Understood.

It's a bit verbose though. It could be convenient to have shorter forms. Say, / followed by double quotes would mean a pathname, while / not followed by double quotes would be an IP.