Re: $'s in java class member names and set!

2010-09-09 Thread Jon Seltzer
Yeah.  I tried that but it gives what you expect:

Class A defined as follows:

package projects.test;
public class A
{
  public boolean y;
  public boolean $z;
}

REPL:

user= (import '(projects.test A))
projects.test.A
user= (def m (A.))
#'user/m
user= (set! (. m y) true)
true
user= (set! (. m $z) true)
java.lang.IllegalArgumentException: No matching field found:
_DOLLARSIGN_z for class projects.test.A
 (NO_SOURCE_FILE:0)
user= (def klass (.getClass m))
#'user/klass
user= (def fields (.getFields klass))
#'user/fields
user= (.getName (aget fields 0))
y
user= (.getName (aget fields 1))
$z
user=

Just so everyone knows this isn't a trumped up example.  If I can make
this work then I can instantiate JavaFX classes directly without using
JavaFX reflection.  I'm exploring a Clojure cover library for JavaFX.
Incidently, some of you might be interested in this:

http://steveonjava.com/javafx-your-way-building-javafx-applications-with-alternative-languages/

Stephen Chin will presenting a talk at JavaOne about using other JVM
languages to call JavaFX.

On Sep 8, 8:05 pm, Sean Devlin francoisdev...@gmail.com wrote:
 Try using reflection to print out what the JVM thinks the field's name
 is.  This might help.

 On Sep 8, 1:23 am, Jon Seltzer seltzer1...@gmail.com wrote:



  Suppose you have a class projects.test.A:

  package projects.test;

  public class A
  {
    public A(){super();}
    public boolean y;
    public boolean $z;

  }

  and I want to use set to update both values:

  user= (def m (A.))     ; Create a ref m to new instance of A
  #'user/m

  user= (set! (. m y) true)     ; No problems updating y.
  true

  user= (set! (. m $z) true)
  java.lang.IllegalArgumentException: No matching field found:
  _DOLLARSIGN_z for class projects.test.A
   (NO_SOURCE_FILE:0)

  Is there a special syntax for handling java members with $'s in their
  names?- Hide quoted text -

 - Show quoted text -

-- 
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


Re: $'s in java class member names and set!

2010-09-09 Thread Michał Marczyk
That's probably due to a problem with clojure.core/munge I recently
reported on the Dev list [1] -- see a proposed patch attached to my
first e-mail in that thread. I notice there still hasn't been any
response to that issue... I think I'm just going to go ahead an open a
ticket for this tonight.

Sincerely,
Michał

[1] 
http://groups.google.com/group/clojure-dev/browse_thread/thread/9caab13eafa10f80

-- 
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


Re: $'s in java class member names and set!

2010-09-09 Thread Michał Marczyk
Ticket created:

http://www.assembla.com/spaces/clojure/tickets/433-munge-should-not-munge-$-(which-isjavaidentifierpart)--should-munge---(which-is-not)

Sincerely,
Michał

-- 
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


Re: $'s in java class member names and set!

2010-09-09 Thread Jon Seltzer
I suspect $ is in munge because Rich and company may want to use it as
a special reader character.  $'s used to access inner classes work
fine.  I'd be fine with that as long as there's still a way to access
Java identifiers with dollar signs (perhaps a special macro).

On Sep 9, 3:49 am, Michał Marczyk michal.marc...@gmail.com wrote:
 That's probably due to a problem with clojure.core/munge I recently
 reported on the Dev list [1] -- see a proposed patch attached to my
 first e-mail in that thread. I notice there still hasn't been any
 response to that issue... I think I'm just going to go ahead an open a
 ticket for this tonight.

 Sincerely,
 Michał

 [1]http://groups.google.com/group/clojure-dev/browse_thread/thread/9caab...

-- 
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


Re: $'s in java class member names and set!

2010-09-08 Thread Sean Devlin
Try using reflection to print out what the JVM thinks the field's name
is.  This might help.

On Sep 8, 1:23 am, Jon Seltzer seltzer1...@gmail.com wrote:
 Suppose you have a class projects.test.A:

 package projects.test;

 public class A
 {
   public A(){super();}
   public boolean y;
   public boolean $z;

 }

 and I want to use set to update both values:

 user= (def m (A.))     ; Create a ref m to new instance of A
 #'user/m

 user= (set! (. m y) true)     ; No problems updating y.
 true

 user= (set! (. m $z) true)
 java.lang.IllegalArgumentException: No matching field found:
 _DOLLARSIGN_z for class projects.test.A
  (NO_SOURCE_FILE:0)

 Is there a special syntax for handling java members with $'s in their
 names?

-- 
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