There are a number of aspects of the CLR dissimilar to the JVM that
the current implementation of ClojureCLR does not properly account
for.  Some of these will require extensions to Clojure, e.g. in symbol
syntax if we are to allow CLR-specific type references.

A short and by no means complete list of these things:

Proper handling of generic types
Proper handling of value types (mostly okay because so much gets
boxed)
References to types that include assembly information (no classpath/
classloader fun)
True multidimensional arrays

--David

On Jul 2, 1:23 am, "Ted Neward" <ted.new...@gmail.com> wrote:
> Be careful with assumptions about the two platforms--extension methods, for
> example, are purely a fiction of the C# compiler. No CLR support was added
> to provide anything that shipped as part of C# 3.0--just compiler and
> libraries.
>
> Ditto (AFAICT) for .NET 4.0. The new "dynamic" keyword is just syntactic
> sugar.
>
> To do the comparisons justice, you should look solely at the JVM
> Specification and the ECMA CLI Specification documents (at least the first 3
> partitions).
>
> Ted Neward | Principal Consultant, ThoughtWorks
> Java, .NET, XML Services
> Consulting, Teaching, Speaking, 
> Writinghttp://www.thoughtworks.com|http://www.tedneward.com
>
> > -----Original Message-----
> > From: clojure@googlegroups.com [mailto:cloj...@googlegroups.com] On
> > Behalf Of mmwaikar
> > Sent: Wednesday, July 01, 2009 6:01 PM
> > To: Clojure
> > Subject: Re: Problem with clojure code on .net.
>
> > Thanks a lot Daniel for your suggestions. As per my understanding
> > Clojure for Java and .Net are two implementations of the same
> > language, but they have to support different things because the
> > underlying platforms support different things - e.g. extension methods
> > (are in C# but most likely not in Java).
>
> > I realized the naming convention of methods. Similarly, what should be
> > the convention for naming method parameters? Is it pascalCase?
>
> > Also, I'll have to check when-let and re-find, I am still not familiar
> > with it.
>
> > As for the program, I had to write a simple cmd line tool a few days
> > back at my work, which converts images from one format to other (by
> > using an external tool) and copies the converted images to specific
> > folders (based on the file names), hence the subfolder name fn.
>
> > On Jul 1, 1:58 am, Daniel Lyons <fus...@storytotell.org> wrote:
> > > Manoj,
>
> > > In case this helps, I've had a bit longer to dwell on this problem
> > and
> > > I have a couple of ideas. I do think this raises the general question
>
> > > of, are Clojure .NET and Clojure Java two different languages or two
>
> > > implementations of the same language? Normally in a situation like
> > > this (say, Jython and Python) I would say that they should be two
> > > implementations of the same language but the situation is complicated
>
> > > by the fact that Clojure code relies heavily on Java objects since
> > the
> > > policy is not to wrap everything. I'm not sure how the subject of
> > > Clojure .NET / Java portability has been approached but my naïve
> > guess
> > > is that it would revolve around separating Java dependencies and .NET
>
> > > dependencies from pure Clojure code. Is anyone else addressing these
>
> > > issues in their own code at this time?
>
> > > Back to your code. First of all, to simplify things, it's probably a
>
> > > good idea to decouple your I/O from your parsing, since the parsing
> > > can be functional. First I rewrote starts-with-hmorx into this:
>
> > > (defn starts-with-hm-or-x [name]
> > >    (#{\H \M \X} (.charAt name 0)))
>
> > > Which I think is simpler, building on the fact that sets can be used
>
> > > as functions, but then I thought it would probably be better to
> > > rewrite the functions into one that gets the information from the
> > > filesystem and another one that gets the information you want out:
>
> > > (defn parse-subfolder-name
> > >    [name]
> > >    (or
> > >     (when-let [[_ digit] (re-find #"(\d).*" name)]
> > >       (Integer/parseInt digit))
> > >     (when-let [[_ hmx] (re-find #"([hHmMxX]).*" name)]
> > >       (.toLowerCase hmx))
> > >     "other"))
>
> > > Unfortunately I'm still dependent on some Java API stuff in there,
> > but
> > > I think you can probably translate to the .NET equivalents. This is
> > > easier to test at the REPL:
>
> > > user> (parse-subfolder-name "0stuf")
> > > 0
> > > user> (parse-subfolder-name "Hstuf")
> > > "h"
> > > user> (parse-subfolder-name "stuf")
> > > "other"
>
> > > Then I'd set about handling the loading of the filename and
> > > dispatching it:
>
> > > (defn get-subfolder-name
> > >    [filename]
> > >    (parse-subfolder-name
> > >     (.ToString (Path/GetFileNameWithoutExtensions filename))))
>
> > > Now it should be easier to determine where the problem is, either in
>
> > > the I/O code or in the functional code which is easier to test at the
>
> > > REPL.
>
> > > As an aside, I'd recommend that you follow the naming convention of
> > > using lowercase function names with words separated by hypens (get-
> > > subfolder-name) rather than CamelCase (GetSubfolderName). Also, it
> > > doesn't look to me like GetSubfolderName is really returning a
> > > subfolder's name but I'm not quite sure what it is doing either. Are
>
> > > you working on an app with specific meaning tied to the first
> > > character of a path name or is this a .NET filesystem thing? Just
> > > curious.
>
> > > Thanks and hope this helps,
>
> > > —
> > > Daniel Lyons
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to