So what happens if you got a reference to a file that exists, and before you 
get 
to use it, something else deletes the file?

 Alexey





________________________________
From: Kevin Wright <[email protected]>
To: [email protected]
Cc: Miroslav Pokorny <[email protected]>
Sent: Mon, March 14, 2011 11:00:48 AM
Subject: Re: [The Java Posse] Some design questions (about immutability and 
other stuff)




On 14 March 2011 14:48, Miroslav Pokorny <[email protected]> wrote:


>
>
>On Tue, Mar 15, 2011 at 1:46 AM, Alexey Zinger <[email protected]> wrote:
>
>I see a small problem with the Scala stuff.  Specifically:
>>
>>
>>
>>  FileRef
>>  - DirectoryFileRef
>>  - StreamableFileRef
>>    - AppendableFileRef
>>      - RandomAccessFileRef
>>  - NonExistantFileRef
>>
>>How does this address the scenario of a non-existent file reference 
>>"becoming" 
>>existent by a side-effect of code elsewhere (maybe outside current execution 
>>thread, or the JVM as a whole)?  But in general, this just feels like a 
>>losing 
>>battle to me -- trying to apply immutability principles to I/O.  Why?
>> Alexey
>>
>>
>>
>
>Its about naming, if your name is wrong your going to have a hard to time 
>defending it. Calling an Elephant a Frog is never right. 
>
>
> 
-- 
>You received this message because you are subscribed to the Google Groups "The 
>Java Posse" group.
>To post to this group, send email to [email protected].
>To unsubscribe from this group, send email to 
>[email protected].
>For more options, visit this group at 
>http://groups.google.com/group/javaposse?hl=en.
>


If you attempt to get a reference from a file that doesn't exist, you'll be 
returned a NonExistentFileRef
That's IT.  The thing is fixed, never to change again, it's the very definition 
of immutable.

If you later try to obtain a reference to the same path, and the file has since 
been created, it'll work.

The only reason that all file references aren't immutable is that operations to 
retrieve the contents aren't guaranteed to always return the same value.  On a 
COW filesystem it's possible that you could grab an immutable read-only 
reference.  The file may be modified or deleted in the interim, but you still 
have a handle to a previous snapshot, and can guarantee the same output every 
single time you read it.

-- 
Kevin Wright

gtalk / msn : [email protected]
mail: [email protected]

vibe / skype: kev.lee.wright
quora: http://www.quora.com/Kevin-Wright
twitter: @thecoda


"My point today is that, if we wish to count lines of code, we should not 
regard 
them as "lines produced" but as "lines spent": the current conventional wisdom 
is so foolish as to book that count on the wrong side of the ledger" ~ Dijkstra

-- 
You received this message because you are subscribed to the Google Groups "The 
Java Posse" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/javaposse?hl=en.



      

-- 
You received this message because you are subscribed to the Google Groups "The 
Java Posse" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/javaposse?hl=en.

Reply via email to