By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
431,983 Members | 1,717 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 431,983 IT Pros & Developers. It's quick & easy.

Weird problem - commenting out doesn't work...

P: n/a
Normally, one can put any bull as long as comments are on, as in:

// import yava.biteme.yo_mamma;

but when i tried to do

//String s = "\u305\u3048";

the stupid computer tells me to shut up by claiming that it's an
illegal unicode escape. Now, i've bought it, so i'll tell it what is
and what isn't a legal escape.

How come the compiler looks at the comments at all?

Also - i tried to combine "\u305" with an int (taken from a for-loop
that goes from 0 to 9). The same problem there. No, señor! Enter all
four digits after "\u" or i'll bollock up the compilation for you!

What is this?!
--

Kindly
Konrad
---------------------------------------------------
May all spammers die an agonizing death; have no burial places;
their souls be chased by demons in Gehenna from one room to
another for all eternity and more.

Sleep - thing used by ineffective people
as a substitute for coffee

Ambition - a poor excuse for not having
enough sense to be lazy
---------------------------------------------------


Jul 17 '05 #1
Share this Question
Share on Google+
7 Replies


P: n/a
Konrad Den Ende wrote:
Normally, one can put any bull as long as comments are on, as in:

// import yava.biteme.yo_mamma;

but when i tried to do

//String s = "\u305\u3048";

the stupid computer tells me to shut up by claiming that it's an
illegal unicode escape. Now, i've bought it, so i'll tell it what is
and what isn't a legal escape.

How come the compiler looks at the comments at all?
It evaluates the \u stuff right at the start ("at the lexical level"),
before it tries to do any parsing at all, even before it tries to see what
is comments and what is code. That's not what you expect, but it's what
the language specification says it should do.
Also - i tried to combine "\u305" with an int (taken from a for-loop
that goes from 0 to 9). The same problem there. No, señor! Enter all
four digits after "\u" or i'll bollock up the compilation for you!


You're trying to define a "string constant", so you can hardly expect it to
take a different value each time you go around the loop.

--
Chris Gray ch***@kiffer.eunet.be

Jul 17 '05 #2

P: n/a
>> Also - i tried to combine "\u305" with an int (taken from a for-loop
that goes from 0 to 9). The same problem there. No, señor! Enter all
four digits after "\u" or i'll bollock up the compilation for you!


It evaluates the \u stuff right at the start ("at the lexical level"),
before it tries to do any parsing at all, even before it tries to see what
is comments and what is code. That's not what you expect, but it's what
the language specification says it should do.


Got it. It's kind of annoying since i expected it to behave differently
but, as you pointed out, if it's supposed to be that way, one has to
adjust to it and use it.

It's a surprising thing at the very first glance, though.
Thank you.

--

Kindly
Konrad
---------------------------------------------------
May all spammers die an agonizing death; have no burial places;
their souls be chased by demons in Gehenna from one room to
another for all eternity and more.

Sleep - thing used by ineffective people
as a substitute for coffee

Ambition - a poor excuse for not having
enough sense to be lazy
---------------------------------------------------


Jul 17 '05 #3

P: n/a
nos

"chris" <ch***@kiffer.eunet.be> wrote in message
news:bu**********@reader10.wxs.nl...
Konrad Den Ende wrote:
Normally, one can put any bull as long as comments are on, as in:

// import yava.biteme.yo_mamma;

but when i tried to do

//String s = "\u305\u3048";

the stupid computer tells me to shut up by claiming that it's an
illegal unicode escape. Now, i've bought it, so i'll tell it what is
and what isn't a legal escape.

How come the compiler looks at the comments at all?
It evaluates the \u stuff right at the start ("at the lexical level"),
before it tries to do any parsing at all, even before it tries to see what
is comments and what is code. That's not what you expect, but it's what
the language specification says it should do.
Also - i tried to combine "\u305" with an int (taken from a for-loop
that goes from 0 to 9). The same problem there. No, señor! Enter all
four digits after "\u" or i'll bollock up the compilation for you!


You're trying to define a "string constant", so you can hardly expect it

to take a different value each time you go around the loop.

--
Chris Gray ch***@kiffer.eunet.be

Do you know the url where i can look at this part of the language spec?
TNX
Jul 17 '05 #4

P: n/a
nos wrote:

"chris" <ch***@kiffer.eunet.be> wrote in message
news:bu**********@reader10.wxs.nl...
Konrad Den Ende wrote:
> Normally, one can put any bull as long as comments are on, as in:
>
> // import yava.biteme.yo_mamma;
>
> but when i tried to do
>
> //String s = "\u305\u3048";
>
> the stupid computer tells me to shut up by claiming that it's an
> illegal unicode escape. Now, i've bought it, so i'll tell it what is
> and what isn't a legal escape.
>
> How come the compiler looks at the comments at all?


It evaluates the \u stuff right at the start ("at the lexical level"),
before it tries to do any parsing at all, even before it tries to see
what is comments and what is code. That's not what you expect, but it's
what the language specification says it should do.
> Also - i tried to combine "\u305" with an int (taken from a for-loop
> that goes from 0 to 9). The same problem there. No, señor! Enter all
> four digits after "\u" or i'll bollock up the compilation for you!


You're trying to define a "string constant", so you can hardly expect it

to
take a different value each time you go around the loop.

--
Chris Gray ch***@kiffer.eunet.be

Do you know the url where i can look at this part of the language spec?
TNX


http://java.sun.com/docs/books/jls/s...doc.html#48198

See also the preceding chapter, which makes it clear that lexical
processing precedes syntactical processing.

You can write a Java program with Chinese variable names and Arabic
comments, and then losslessly translate it into US-ASCII and back again by
using the \unnnn escapes. If you look at it that way, it starts to make
sense.

--
Chris Gray ch***@kiffer.eunet.be
/k/ Embedded Java Solutions

Jul 17 '05 #5

P: n/a
"nos" <no*@nospam.com> wrote:
"chris" <ch***@kiffer.eunet.be> wrote in message

[snip]
It evaluates the \u stuff right at the start ("at the lexical level"),
before it tries to do any parsing at all, even before it tries to see what
is comments and what is code. That's not what you expect, but it's what
the language specification says it should do. [snip]

Do you know the url where i can look at this part of the language spec?


http://java.sun.com/docs/books/jls/s...xical.doc.html
Jul 17 '05 #6

P: n/a
Way too many of these have entered into Java on all fronts. A once elegant
language has become a bug breeding ground.
"Konrad Den Ende" <ch************@bigfoot.com> wrote in message
news:bu**********@news.gu.se...
Also - i tried to combine "\u305" with an int (taken from a for-loop
that goes from 0 to 9). The same problem there. No, señor! Enter all
four digits after "\u" or i'll bollock up the compilation for you!


It evaluates the \u stuff right at the start ("at the lexical level"),
before it tries to do any parsing at all, even before it tries to see what is comments and what is code. That's not what you expect, but it's what
the language specification says it should do.


Got it. It's kind of annoying since i expected it to behave differently
but, as you pointed out, if it's supposed to be that way, one has to
adjust to it and use it.

It's a surprising thing at the very first glance, though.
Thank you.

--

Kindly
Konrad
---------------------------------------------------
May all spammers die an agonizing death; have no burial places;
their souls be chased by demons in Gehenna from one room to
another for all eternity and more.

Sleep - thing used by ineffective people
as a substitute for coffee

Ambition - a poor excuse for not having
enough sense to be lazy
---------------------------------------------------

Jul 17 '05 #7

P: n/a
Way too many of these have entered into Java on all fronts. A once elegant
language has become a bug breeding ground.
"Konrad Den Ende" <ch************@bigfoot.com> wrote in message
news:bu**********@news.gu.se...
Also - i tried to combine "\u305" with an int (taken from a for-loop
that goes from 0 to 9). The same problem there. No, señor! Enter all
four digits after "\u" or i'll bollock up the compilation for you!


It evaluates the \u stuff right at the start ("at the lexical level"),
before it tries to do any parsing at all, even before it tries to see what is comments and what is code. That's not what you expect, but it's what
the language specification says it should do.


Got it. It's kind of annoying since i expected it to behave differently
but, as you pointed out, if it's supposed to be that way, one has to
adjust to it and use it.

It's a surprising thing at the very first glance, though.
Thank you.

--

Kindly
Konrad
---------------------------------------------------
May all spammers die an agonizing death; have no burial places;
their souls be chased by demons in Gehenna from one room to
another for all eternity and more.

Sleep - thing used by ineffective people
as a substitute for coffee

Ambition - a poor excuse for not having
enough sense to be lazy
---------------------------------------------------

Jul 17 '05 #8

This discussion thread is closed

Replies have been disabled for this discussion.