Re: Compilable clojure program, but unreadable?

2012-03-12 Thread Meikel Brandmeyer (kotarak)
Hi,

so it is not as consistent as it could be.

Sincerely
Meikel

-- 
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: Compilable clojure program, but unreadable?

2012-03-11 Thread Jonas
Hi,

Is this inconsistent behaviour:

user=> `s/foo
s/foo
user=> ::s/foo
#
nil
user=> (require '[clojure.string :as s])
nil
user=> `s/foo
clojure.string/foo
user=> ::s/foo
:clojure.string/foo

I think that ::s/foo should be resolved to :s/foo if there is no alias for 
s (like symbols).

Jonas


On Monday, March 12, 2012 1:50:50 AM UTC+2, Meikel Brandmeyer (kotarak) 
wrote:
>
> Hi,
>
> Am 12.03.2012 um 00:09 schrieb Stuart Sierra:
>
> > The syntax ::s/kwd is incorrect syntax: it should be either ::kwd (which 
> will resolve in the current namespace) or :s/kwd (only one colon).
>
> The reader page says, with :: they are resolved in the current namespace. 
> And this seems to work since they where introduced:
>
> user=> (require '[clojure.string :as s])
> nil
> user=> ::s/join
> :clojure.string/join
> user=> `s/join
> clojure.string/join
>
> Just as s/join gets resolved to the clojure.string/join, ::s/join gets 
> resolved to :clojure.string/join. Sounds consistent and not in violation of 
> the reader page.
>
> Sincerely
> Meikel
>
>

-- 
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: Compilable clojure program, but unreadable?

2012-03-11 Thread Meikel Brandmeyer
Hi,

Am 12.03.2012 um 00:09 schrieb Stuart Sierra:

> The syntax ::s/kwd is incorrect syntax: it should be either ::kwd (which will 
> resolve in the current namespace) or :s/kwd (only one colon).

The reader page says, with :: they are resolved in the current namespace. And 
this seems to work since they where introduced:

user=> (require '[clojure.string :as s])
nil
user=> ::s/join
:clojure.string/join
user=> `s/join
clojure.string/join

Just as s/join gets resolved to the clojure.string/join, ::s/join gets resolved 
to :clojure.string/join. Sounds consistent and not in violation of the reader 
page.

Sincerely
Meikel

-- 
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: Compilable clojure program, but unreadable?

2012-03-11 Thread Kevin Downey
On Mar 11, 2012 4:10 PM, "Stuart Sierra" 
wrote:
>
> The syntax ::s/kwd is incorrect syntax: it should be either ::kwd (which
will resolve in the current namespace) or :s/kwd (only one colon).
>
> -S

::s/kwd is valid, it will cause the namespace of the resulting keyword to
be resolved via the namespace aliases in the current namespace.

please enjoy rhickey explaining this to cemerick:
http://clojure-log.n01se.net/date/2009-04-30.html#08:11

Clojure 1.4.0-master-SNAPSHOT

user=> :s/k

:s/k

user=> ::s/k

RuntimeException Invalid token: ::s/k  clojure.lang.Util.runtimeException
(Util.java:170)

user=> (require '[clojure.string :as s])

nil

user=> ::s/k

:clojure.string/k

user=>

>
> --
> 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: Compilable clojure program, but unreadable?

2012-03-11 Thread Stuart Sierra
The syntax ::s/kwd is incorrect syntax: it should be either ::kwd (which 
will resolve in the current namespace) or :s/kwd (only one colon).

-S

-- 
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: Compilable clojure program, but unreadable?

2012-03-10 Thread Meikel Brandmeyer
Hi,

Clojure doesn't read files. It reads, compiles and executes a stream of 
toplevel expressions. Hence the file is compilable, but not readable.

If you do not want to execute the forms contained in a file, you have to avoid 
any dynamic feature. In particular aliased keywords with :: since those can 
only be handled after the require is executed.

Sincerely
Meikel

-Ursprüngliche Nachricht-
Von: Jonas 
An: clojure@googlegroups.com
Gesendet: So, 11 Mrz 2012, 07:26:28 MEZ
Betreff: Compilable clojure program, but unreadable?

Hi

If I have the following short Clojure program:

;; unread.clj
(require '[clojure.string :as s])
(prn ::s/kwd)

The second form can't be read by the clojure reader:

user=> (def reader (java.io.PushbackReader. (clojure.java.io/reader 
"unread.clj")))
#'user/reader
user=> (read reader)
(require (quote [clojure.string :as s]))
user=> (read reader)
java.lang.Exception: Invalid token: ::s/kwd (NO_SOURCE_FILE:0)

But if I load the file, prior to reading it, it works fine:

user=> (load-file "unread.clj")
:clojure.string/kwd
nil
user=> (def reader (java.io.PushbackReader. (clojure.java.io/reader 
"unread.clj")))
#'user/reader
user=> (read reader)
(require (quote [clojure.string :as s]))
user=> (read reader)
(prn :clojure.string/kwd)

Can anyone think of a way to read the file without loading/compiling it?

Thanks,
Jonas

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

Compilable clojure program, but unreadable?

2012-03-10 Thread Jonas
Hi

If I have the following short Clojure program:

;; unread.clj
(require '[clojure.string :as s])
(prn ::s/kwd)

The second form can't be read by the clojure reader:

user=> (def reader (java.io.PushbackReader. (clojure.java.io/reader 
"unread.clj")))
#'user/reader
user=> (read reader)
(require (quote [clojure.string :as s]))
user=> (read reader)
java.lang.Exception: Invalid token: ::s/kwd (NO_SOURCE_FILE:0)

But if I load the file, prior to reading it, it works fine:

user=> (load-file "unread.clj")
:clojure.string/kwd
nil
user=> (def reader (java.io.PushbackReader. (clojure.java.io/reader 
"unread.clj")))
#'user/reader
user=> (read reader)
(require (quote [clojure.string :as s]))
user=> (read reader)
(prn :clojure.string/kwd)

Can anyone think of a way to read the file without loading/compiling it?

Thanks,
Jonas

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