fbpx
Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC: [2.11] Single vs. double quotes

[2.11] Single vs. double quotes 1 year 11 months ago #1

Just got me the new build, install went smoothly.
Read in What's new:
...
In the Core and VO dialect a literal string that is enclosed with single quotes is a string literal. Double quotes are also string literals...

Starting with template "Basic X#" sample (with Xide 1.09):

FUNCTION Start( ) AS VOID
LOCAL c AS STRING
c:='x'
RETURN

Compiling i get:
Compilation failed (1 error)
error XS0029: Cannot implicitly convert type 'char' to 'string' 3,5 Start.prg Stringdelim

Either i misunderstand the help file or there is something amiss...
On further tries, i find:
LOCAL d AS Char
d:='y'
compiles - without the 'c'prefacing the help says i'd need!?

For completeness is started VS17, tried the same and see the same result.


@Chris: i see this new app listed as "StringDelim(v4.0)-X#", note the missing "/Core" part (properties show language X# and dialect Core) - is this new convention?

HTH
Karl

Please Log in or Create an account to join the conversation.

Last edit: by FFF. Reason: typo

[2.11] Single vs. double quotes 1 year 11 months ago #2

Hi Karl,

I think you are right, this needs some further clarification. At the moment (in Core dialect), if you specify only one character delimited with single quotes, then this is treated as a Char constant. If there are more than one characters, then it is treated as String. Maybe we will need to review this a bit more again..

As for the "/Core" test not appearing in XIDE, this is a small bug, next time you open the project it will be displayed normally.

Chris
XSharp Development Team
chris(at)xsharp.eu

Please Log in or Create an account to join the conversation.

[2.11] Single vs. double quotes 1 year 11 months ago #3

Chris Pyrgas wrote: Hi Karl,

I think you are right, this needs some further clarification. At the moment (in Core dialect), if you specify only one character delimited with single quotes, then this is treated as a Char constant. If there are more than one characters, then it is treated as String. Maybe we will need to review this a bit more again..

Yes. Too much "implicit" thinking needed ;)
BTW, i wonder, why we need the "special" quoting at all? Either the declaration of a var is needed, then there should be no need to "mark" the name in any special kind - or the compiler deduces the type from the assign, then we could drop the declare <g>.

As for the "/Core" test not appearing in XIDE, this is a small bug, next time you open the project it will be displayed normally.

Indeed. No problem...

Please Log in or Create an account to join the conversation.

Last edit: by FFF. Reason: typo
  • Page:
  • 1