Re: Is anyone relying on the js* special form?

2012-09-24 Thread Herwig Hochleitner
2012/9/25 Brandon Bloom 

> clojurescript gives no access to javascript's delete operator.
>>
>
>
There is a js-delete macro in core. It uses the same form as your proposed
> adel form.
>

Oh, beg your pardon, I have overlooked that.
I have to admit, a del! form for deleting advanced-optimized properties is
arguably less important, since you can't reflect on them anyways.

-- 
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: Map-destructuring a non-associative structure, non documented behavior?

2012-09-24 Thread Ben Smith-Mannschott
On Tue, Sep 25, 2012 at 5:10 AM, Nahuel Greco  wrote:
> I can't find the documentation for this behaviour:
>
> (let [{x :b :as y} '(:a 1 :b 2)] [x y])
>
> ;=> [2 {:a 1, :b 2}]
>
> It seems as if the list in the init-expr is converted first to an
> associative structure and then destructured.
> But that behaviour doesn't seems to be documented, the map destructuring
> documentation only talks
> about destructuring of associative structures, and also there is nothing
> about binding the :as expression
> to the resultant associative structure instead of the initial init-expr.
>
> Is this documented somewhere? Is an intended behaviour assured to be present
> in the future Clojure
> versions?

TL;DR: Intentional. Since 1.2.0.

This behavior was added in Clojure 1.2.0, the changes.txt for that release says:

== 2.3 Destructuring Enhanced ==

If you associatively destructure a seq, it will be poured
into a map first:

  (defn foo [& {:keys [a b c]}]
[a b c])

  (foo :c 3 :b 2)
  => [nil 2 3]

But, I didn't see a reference to this behavior on the page on
clojure.org where special forms and destructuring are discussed [1].

[1]: http://clojure.org/special_forms#Special Forms--(let [bindings* ] exprs*)

// Ben

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


Map-destructuring a non-associative structure, non documented behavior?

2012-09-24 Thread Nahuel Greco
I can't find the documentation for this behaviour:

(let [{x :b :as y} '(:a 1 :b 2)] [x y])

;=> [2 {:a 1, :b 2}]

It seems as if the list in the init-expr is converted first to an
associative structure and then destructured.
But that behaviour doesn't seems to be documented, the map destructuring
documentation only talks
about destructuring of associative structures, and also there is nothing
about binding the :as expression
to the resultant associative structure instead of the initial init-expr.

Is this documented somewhere? Is an intended behaviour assured to be
present in the future Clojure
versions?

Saludos,
Nahuel Greco.

-- 
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: ANN Ritz 0.5.0

2012-09-24 Thread Hugo Duncan

Tim,


Timothy Washington  writes:

> I was following the instructions on the ritz-nrepl
> page. And
> I get the error below, when executing the "*M-x nrepl-ritz-jack-in*"
> command.

...

> Caused by: java.lang.RuntimeException: Unable to resolve symbol: ex-info in
> this context
> at clojure.lang.Util.runtimeException(Util.java:156)
> at clojure.lang.Compiler.resolveIn(Compiler.java:6720)
> at clojure.lang.Compiler.resolve(Compiler.java:6664)
> at clojure.lang.Compiler.analyzeSymbol(Compiler.java:6625)
> at clojure.lang.Compiler.analyze(Compiler.java:6198)
> ... 171 more

This seems to be an issue with clojure 1.4 not being used in the
controlling vm, and should have been fixed by
https://github.com/pallet/ritz/issues/53, which will be included in the
next release.

> You mention that this is meant to be used in tandem with nrepl.el (*
> nrepl-jack-in*)? Because it looks like a parallel tool (*nrepl-ritz-jack-in*).

You should be able to invoke nrepl-ritz-jack-in once nrepl-ritz.el is
installed.

> Could you run through a typical workflow of setting and using the "*M-x
> nrepl-ritz-break-on-exception*" command? I just want to make sure that I'm
> grokking how to use it.

After running  'M-x nrepl-ritz-break-on-exception', you should get the
debugger activated on an exception. So, entering something like
(throw (Exception. "Hello")) at the repl should result in a debugger
buffer being displayed, showing you a stacktrace.

Hope that helps,

Hugo

-- 
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: ANN Ritz 0.5.0

2012-09-24 Thread Hugo Duncan

Adrian,

adrians  writes:

> I'm trying to get ritz-nrepl going with the latest lein2 and nrepl.el from 
> Melpa. I think I've followed the instructions on the project page, yet I 
> get this, when I nrepl-ritz-jack-in:
>
> error in process sentinel: Could not start nREPL server: Exception in thread 
> "main" java.lang.ClassNotFoundException: com.sun.jdi.VirtualMachine
...

> The same exception is thrown if I invoke ritz-nrepl from the command-line. 
> I'm using jdk 1.7.0_07 with Windows 7 64 bit, if that helps. Any clue as to 
> what's going wrong?

The error is saying that it hasn't been able to find the jdk's tools.jar file.

This is issue https://github.com/pallet/ritz/issues/53, which is now
fixed and will be in the next release.

Hugo

-- 
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: Is anyone relying on the js* special form?

2012-09-24 Thread Brandon Bloom

>
> clojurescript gives no access to javascript's delete operator.
>

There is a js-delete macro in core. It uses the same form as your proposed 
adel form.

-- 
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: clojurescript: var names with "-" and "_" are rendered to the same internal name (?)

2012-09-24 Thread Herwig Hochleitner
2012/9/24 Frank Siebenlist 

> Guess the AOT compiler uses it but the REPL-one doesn't (???).
>

The reason for this is two-fold:

1) Vars in Clojure are not suffering from that issue, since they are
reified. That means, that their field in the java class is a generated name
and they are interned by their string name. So a def works one way or the
other.

2) With the defn, the *function* classes are named after their namespace
var. So (type foo-bar) => core$foo_bar. When evaluating a defn from the
repl, the fn class is emitted, loaded into the class loader and an instance
of it is assigned to the var. When aot compiling, however, the fn classes
are written as .class files and instantiated (and assigned to their vars)
in the namespace constructor.

When you aot compile my example and look at the classes with jd, you see
that there is just one fn class file core$foo_bar.class. That means that
the former one got overwritten.

In core__init.class you see that two vars are created with their correct
names, but both are assigned an instance of the same class.

-- 
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: Is anyone relying on the js* special form?

2012-09-24 Thread Herwig Hochleitner
2012/9/13 David Nolen 

> If people are encountering reasons
> to use it - something is missing from ClojureScript that needs to be
> provided.


I think I found such a reason: clojurescript gives no access to
javascript's delete operator. Deleting is not the same as setting to
undefined. I propose a new form (del! (.-prop o)) and a new function (adel
o "prop"). Shall I open a ticket?

-- 
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: clojurescript: var names with "-" and "_" are rendered to the same internal name (?)

2012-09-24 Thread Frank Siebenlist
Thanks for digging.

The mapping of "-" to "_" comes indeed from clojure.lang.Compile/munge which is 
called by cljsh.compiler/munge:


user=> (#'cljs.compiler/munge "-")
"_"
user => (clojure.lang.Compiler/munge "-")
"_"
user => (clojure.lang.Compiler/munge "_")
"_"
user => 


Looking at the java-source, the reason can be found in the CHAR_MAP mapping 
table in Compiler.java:


static final public IPersistentMap CHAR_MAP =
PersistentHashMap.create('-', "_",
//   '.', "_DOT_",
':', "_COLON_",
'+', "_PLUS_",
'>', "_GT_",
'<', "_LT_",
'=', "_EQ_",
'~', "_TILDE_",
'!', "_BANG_",
'@', "_CIRCA_",
'#', "_SHARP_",
'\'', "_SINGLEQUOTE_",
'"', "_DOUBLEQUOTE_",
'%', "_PERCENT_",
'^', "_CARET_",
'&', "_AMPERSAND_",
'*', "_STAR_",
'|', "_BAR_",
'{', "_LBRACE_",
'}', "_RBRACE_",
'[', "_LBRACK_",
']', "_RBRACK_",
'/', "_SLASH_",
'\\', "_BSLASH_",
'?', "_QMARK_");

static public String munge(String name){
StringBuilder sb = new StringBuilder();
for(char c : name.toCharArray())
{
String sub = (String) CHAR_MAP.valAt(c);
if(sub != null)
sb.append(sub);
else
sb.append(c);
}
return sb.toString();
}


Note that it's in the first entry of CHAR_MAP - a little obscured by the 
(original) formatting.

What's puzzling is that all mappings use a convention to map the char to a 
_WORD_ , except the "-" which gets mapped to "_" directly.

What's further puzzling is that in the clj-repl this mapping deosn't seemed to 
be used:


user=> (def my-var "YES")
#'user/my-var
user => (def my_var "NO")
#'user/my_var
user => my-var
"YES"
swimtimer=> 


Guess the AOT compiler uses it but the REPL-one doesn't (???).

Confused - FrankS.


On Sep 24, 2012, at 6:53 AM, Herwig Hochleitner  wrote:

> 
> Not sure if this has been reported before - I searched JIRA and the mailing 
> list, but couldn't find anything, but it's difficult to search for "_"…
> 
> Bug?
> Mapping limitation?
> 
> This behavior comes from cljs.compiler/munge, I'd say it's a mapping 
> limitation that should be considered a bug.
> A possible fix would be to replace _ with _UNDERSCORE_ in munge.
> 
> Notice that clojure.core/munge has the same limitation and should probably 
> fixed aswell:
> 
> (defn foo-bar []
>   "DASH")
> 
> (defn foo_bar []
>   "UNDERSCORE")
> 
> (defn -main []
>   (println "Dash version: " (foo-bar))
>   (println "Underscore version: " (foo_bar)))
> 
> 
> When AOT compiling this example and running it, it prints:
> 
> Dash version:  UNDERSCORE
> Underscore version:  UNDERSCORE
> 
> as opposed to the expected
> 
> Dash version:  DASH
> Underscore version:  UNDERSCORE
> 
> when running from source.
> 
> -- 
> 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

-- 
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: clojurescript: var names with "-" and "_" are rendered to the same internal name (?)

2012-09-24 Thread Frank Siebenlist
That CLJS-336 feels like a different issue that doesn't map to what I'm 
seeing...

On Sep 24, 2012, at 1:45 AM, Raju Bitter  wrote:

> Identifiers in JavaScript cannot contain a hyphen/minus character:
> https://developer.mozilla.org/en-US/docs/JavaScript/Guide/Values,_variables,_and_literals
>> A JavaScript identifier must start with a letter, underscore (_), or dollar 
>> sign ($);
>> subsequent characters can also be digits (0-9). Because JavaScript is case
>> sensitive, letters include the characters "A" through "Z" (uppercase) and the
>> characters "a" through "z" (lowercase).
>> Starting with JavaScript 1.5, you can use ISO 8859-1 or Unicode letters such
>> as å and ü in identifiers. You can also use the \u Unicode escape
>> sequences as characters in identifiers."
> 
> ClojureScript maps all hyphens in identifiers to underscores.
> 
> This has been reported as a bug for protocols before:
> http://dev.clojure.org/jira/browse/CLJS-336
> 
> - Raju

-- 
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: clojurescript: var names with "-" and "_" are rendered to the same internal name (?)

2012-09-24 Thread Herwig Hochleitner
> Not sure if this has been reported before - I searched JIRA and the
> mailing list, but couldn't find anything, but it's difficult to search for
> "_"…
>
> Bug?
> Mapping limitation?
>

This behavior comes from cljs.compiler/munge, I'd say it's a mapping
limitation that should be considered a bug.
A possible fix would be to replace _ with _UNDERSCORE_ in munge.

Notice that clojure.core/munge has the same limitation and should probably
fixed aswell:

(defn foo-bar []
  "DASH")

(defn foo_bar []
  "UNDERSCORE")

(defn -main []
  (println "Dash version: " (foo-bar))
  (println "Underscore version: " (foo_bar)))


When AOT compiling this example and running it, it prints:

Dash version:  UNDERSCORE
Underscore version:  UNDERSCORE

as opposed to the expected

Dash version:  DASH
Underscore version:  UNDERSCORE

when running from source.

-- 
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: clojurescript: var names with "-" and "_" are rendered to the same internal name (?)

2012-09-24 Thread Raju Bitter
Identifiers in JavaScript cannot contain a hyphen/minus character:
https://developer.mozilla.org/en-US/docs/JavaScript/Guide/Values,_variables,_and_literals
> A JavaScript identifier must start with a letter, underscore (_), or dollar 
> sign ($);
> subsequent characters can also be digits (0-9). Because JavaScript is case
> sensitive, letters include the characters "A" through "Z" (uppercase) and the
> characters "a" through "z" (lowercase).
> Starting with JavaScript 1.5, you can use ISO 8859-1 or Unicode letters such
>  as å and ü in identifiers. You can also use the \u Unicode escape
> sequences as characters in identifiers."

ClojureScript maps all hyphens in identifiers to underscores.

This has been reported as a bug for protocols before:
http://dev.clojure.org/jira/browse/CLJS-336

- Raju

-- 
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: ANN Ritz 0.5.0

2012-09-24 Thread Stefan Hübner
adrians  writes:

> Hi Hugo,
>
> I'm trying to get ritz-nrepl going with the latest lein2 and nrepl.el from 
> Melpa. I think
> I've followed the instructions on the project page, yet I get this, when I
> nrepl-ritz-jack-in:
>
> error in process sentinel: Could not start nREPL server: Exception in thread 
> "main" java.lang.ClassNotFoundException: com.sun.jdi.VirtualMachine
>
> [...]
>
> The same exception is thrown if I invoke ritz-nrepl from the command-line. 
> I'm using jdk
> 1.7.0_07 with Windows 7 64 bit, if that helps. Any clue as to what's going 
> wrong?

I had the same problem a while ago. Putting the JDK's tools.jar on the
classpath solved it.

-- 
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: Clojure Course on Coursera

2012-09-24 Thread Joshua Ballanco
Zed Shaw's been working on just such a thing (generic online learning 
environment) over at https://inculcate.me/ . It's still early, so I don't know 
if he's even accepting third-party courses just yet, but it might be 
interesting to reach out to him...

--
Joshua Ballanco

ELC Technologies™
1771 NW Pettygrove Street, Suite 140
Portland, OR, 97209
jballanco (mailto:jballa...@elctech.com)@elctech.com 
(mailto:kmil...@elctech.com)

P +1 866.863.7365
F +1 877.658.6313
M +1 646.463.2673
T +90 533.085.5773

http://www.elctech.com (http://www.elctech.com/)


On Sunday, September 23, 2012 at 10:43 PM, Stefan Edlich wrote:

> The community should make an own course and not wait till some god appears in 
> coursera.
> If someone could host an online learning environment (Google has something 
> new?!)
> we could split Clojure into 100 topics. Then we need 100 persons to produce 
> each a 5-10  
> min Video. I would coordinate the 100 topics and produce one video.  
> We just need 99 other volunteers...Cheers.
>  
> --  
> 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 
> (mailto: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 
> (mailto:clojure+unsubscr...@googlegroups.com)
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en  

-- 
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: Evolving the Clojure contribution process and goals

2012-09-24 Thread Joshua Ballanco
On Wednesday, September 19, 2012 at 6:59 PM, Michael Klishin wrote:
> Paul deGrandis:
> > 4.) What are the limitations behind changing the CA process?  Can the CA 
> > process be made digital (a scan of a signed CA, SSH shared key, OAuth 
> > credential confirmation) or potentially reformed to allow more of the 
> > community to easily get involved, especially for smaller patches or doc 
> > changes?
> > After looking at similar communities (Scala - 
> > http://docs.scala-lang.org/sips/sip-submission.html, Python - 
> > http://www.python.org/psf/contrib/), it seems like there are potential 
> > improvements we could make as the language, ecosystem, and community evolve.
> >  
>  
> It would be great if someone from clojure/core could explain why CAs have to 
> be submitted via snail mail.
>  
> Oracle, OpenJDK, ASF, Neo Technologies and several other companies accept CAs 
> as PDFs. From my personal
> experience with neo4j, it takes no more than a day to submit and have your CA 
> confirmed.
>  
> Sounds like if something is legally acceptable for Oracle, ASF, OpenJDK and 
> significantly smaller yet
> not exactly young companies, it can work well for Clojure?
>  
> The current process definitely does not take a day and is problematic for 
> people who live outside of
> North America and Western Europe. People in Russia, South America, Asia don't 
> necessarily have
> the luxury of cheap, reliable, fast snail mail delivery to North Carolina. 
> FedEx and friends
> charge over $200 for a single sheet of paper mailed to Durham, NC from 
> Moscow. $200+ for an
> opportunity to spend my time contributing to an OSS project in this age of 
> GitHub sounds
> a little unreasonable.
>  
>  
>  


I'd just like to echo this sentiment. I would very much like to contribute to 
Clojure, but getting a CA from Ankara to NC just isn't practical. I'm lucky in 
that I'll be in the US for a couple of conferences later this fall, at which 
point I should be able to send one from a hotel somewhere, but I'm disappointed 
that an electronic copy is not considered sufficient (especially now that 
Preview.app on the Mac let's me import my signature using the web cam). I 
completely understand and agree with the desire for there to be at least a 
small barrier before one can become involved with Clojure development, but 
requiring physical mail seems like a biased barrier that is much larger for 
some than others.


--
Joshua Ballanco

ELC Technologies™
1771 NW Pettygrove Street, Suite 140
Portland, OR, 97209
jballanco (mailto:jballa...@elctech.com)@elctech.com 
(mailto:kmil...@elctech.com)

P +1 866.863.7365
F +1 877.658.6313
M +1 646.463.2673
T +90 533.085.5773

http://www.elctech.com (http://www.elctech.com/)

  

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