On Tue, Apr 14, 2020 at 12:04:22PM -0700, Raoul Schorer wrote:
> Hi,
> 
> The printer and reader doc states that the default printer can write *core* 
> types to be re-read later.
> I am making a kind of "3d IDE" for a custom language using the pict3d lib. 
> I would like to re-use the pict3d types, and prototype with an interpreter 
> that consumes a valid racket datastructure, since my language would not be 
> practical in text format and to avoid writing a lexer/parser.
> 
> Is there a way to dump a program datum containing custom types such as 
> those in pict3d to a file as text, to use as "source code"?
> 
> For example,
> 
> #lang racket
> (require pict3d)
> (define o (open-input-string))
> (write (pos 0 0 0) o)
> (read (open-input-port (get-output-string o)))
> 
> 
> yields: 'origin, that doesn't mean anything out of the pict3d context. So 
> how can I make that work?
> 
> Essentially, I'd like something equivalent to the below (incorrect):
> 
> #lang racket
> (define o (open-output-string))
> (module m racket
>          (require pict3d)
>          (pos 0 0 0))
> (write m o)
> (read (open-input-string (get-output-string o)))
> 
> 
> Is that possible?
> 
> Thanks,
> Raoul

Let me warn you.  Two things that seem to me to be missing from pict3d:
* the ability to paste textures onto objects
* The ability to do intersections on objects
  and excisions of one object from another (eaving a hole)
Maybe I just haven't found these features, but uf you think
you might need them, you should watch out.

Also, a fair amount of the code is written in typed racket.
(I'm not sure how much).  If you pass in a complex pict3d data structure
from outside, it may take substantial time doing the necessary type check.

And although struct declaration has an option to provide a print function 
for the new type (which may well be the deature you seek),
I haven't seen that option being available in typed racket. I'd be 
delighted to be wrong about this.

-- hendrik

> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to racket-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/racket-users/1a126873-2454-4f8c-bc29-e5bb6b6ba42f%40googlegroups.com.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/20200414194907.grotn4qsjznbho2r%40topoi.pooq.com.

Reply via email to