« Return to Thread: [scala] Option vs null

Re: [scala] Option vs null

by tmorris :: Rate this Message:

Reply to Author | View in Thread

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Barry Kelly wrote:

> Tony Morris <tmorris@...> wrote:
>
>> Personally, I'd delete the String function and write a String ->
>> File implicit
>
> I sincerely hope you aren't serious. Strings aren't files, and
> implicitly converting one to the other is a gross sanity violation
> - consider a lexical analyzer that can scan string text or source
> from a file (and thus might be overloaded on both): in this case,
> the string isn't a logical pointer to the file, but rather the
> other way around, the file is a pointer to the source text.
>
> Would you then suggest a File -> String implicit? So that there is
> an asymmetrical bidirectional conversion between strings and files?
>
I'm serious (and so is Jesper it seems). The sentence "Strings aren't
Files" doesn't parse for me because I reason about software using a
different method and without labels. The structure of a File
(java.io.File) as an algebra is isomorphic to a String (which happens
to contradict the statement "Strings aren't Files" - yes they most
definitely are!). Given this isomorphism, I have no problem writing an
implicit inverse.

>
>> (if that is not to your liking, I'd abstract it in away such that
>> it does).
>
> I don't understand that sentence.
It seems that the OP merely wants function composition with the
aforementioned implicit function, however, Scala makes function
composition quite laborious (although, as I mentioned on another
thread, I have shortened this somewhat). Otherwise, whatever functions
are acting over String/File could be abstracted. To answer this more
specifically, I'd need to know these functions.

>
> (I also wish someone would fix the missing Reply-To header in this
> mailing list...)
>

It's been discussed numerous times and I think the conclusion was to
leave it as is. I don't know the details because I seem to care less
than others do, but you might be interested in looking at these
previous threads to get more details.

> -- Barry
>


- --
Tony Morris
http://tmorris.net/

Real-world problems are simply degenerate cases of pure mathematical
problems.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFIdSmrmnpgrYe6r60RAhvrAJ91rYmSHBu9jTI0JECvt8XDL0ZGUgCgjKNb
R4ETLgUBdviPkdVGSQR39Nc=
=Y874
-----END PGP SIGNATURE-----

 « Return to Thread: [scala] Option vs null

LightInTheBox - Buy quality products at wholesale price!