You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
At the present moment, Heresy lacks I/O routines beyond the simple console IO provided by print and input.
However, we have in our hands already the tools then for some basic file I/O: Racket's print and read routines generally default to a port, and as well there is syntax provided to parameterize just which port those routines point to.
BASIC as well already supplies a very similar approach to I/O: The USING keyword. This is defined in the ECMA standard, as well as many MS-derived BASICs, used to point the output of PRINT to a specific port number (generally mapped to disk and printers and such).
I propose borrowing this as a parameterized block, with syntax to indicate what target or source is to be operated on. Initially, I think file I/O is probably the most useful here, and suggest something like the following:
(using file *filename* as ['write/read]
...)
This does beg the question however of whether this violates the functional principle, but remember Rule #3, Heresy is not Haskell. As well, I think limiting this behavior to within explicit 'impure' code-blocks like (using) helps preserve the feel as well, enforcing a certain attention to what is happening whenever such IO is undertaken.
Then again, I may just be mad.
The text was updated successfully, but these errors were encountered:
At the present moment, Heresy lacks I/O routines beyond the simple console IO provided by print and input.
However, we have in our hands already the tools then for some basic file I/O: Racket's print and read routines generally default to a port, and as well there is syntax provided to parameterize just which port those routines point to.
BASIC as well already supplies a very similar approach to I/O: The USING keyword. This is defined in the ECMA standard, as well as many MS-derived BASICs, used to point the output of PRINT to a specific port number (generally mapped to disk and printers and such).
I propose borrowing this as a parameterized block, with syntax to indicate what target or source is to be operated on. Initially, I think file I/O is probably the most useful here, and suggest something like the following:
This does beg the question however of whether this violates the functional principle, but remember Rule #3, Heresy is not Haskell. As well, I think limiting this behavior to within explicit 'impure' code-blocks like (using) helps preserve the feel as well, enforcing a certain attention to what is happening whenever such IO is undertaken.
Then again, I may just be mad.
The text was updated successfully, but these errors were encountered: