Language question -- file = variable ?

Alex Volkov avolkov-Re5JQEeQqe8AvxtiuMwx3w at public.gmane.org
Tue Aug 16 15:16:54 UTC 2011


In python you can write a class that has a file descriptor as a member and
then define __add__, __subtract__ and other methods BUT:

* You can't have slashes in variable names so either you'll need to pass an
actual filename when instantiating or do some metaclass trickery that would
determine file path from object name, but then you'll have to have your own
object naming convention.

* It sounds like you're trying to solve a problem in a weir way.  What are
you trying to solve?

* You can always write your own domain-specific language.

Sent from my mobile device.
On Aug 16, 2011 10:41 AM, "William Park" <opengeometry-FFYn/CNdgSA at public.gmane.org> wrote:
> Hi all,
>
> Is there a language which (natively or not) treats a filename like a
variable in memory?  For example, to increment a counter stored in a file,
you would write something like
>         /tmp/counter = /tmp/counter + 1
> which involves both read and write to a file.  If it were normal variable,
then it would involve read/write to a memory instead.
>
> Python is the closest I can think of.  But, you need to create a method
for read and another method for write.  And, typing more verbose than I
would like.
>
> --
>
> William
> --
> The Toronto Linux Users Group. Meetings: http://gtalug.org/
> TLUG requests: Linux topics, No HTML, wrap text below 80 columns
> How to UNSUBSCRIBE: http://gtalug.org/wiki/Mailing_lists
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://gtalug.org/pipermail/legacy/attachments/20110816/8943da70/attachment.html>


More information about the Legacy mailing list