Comments (8)
THis also does not work:
VAR diction := Dictionary<STRING, STRING>{StringComparer.CurrentCultureIgnoreCase}{ {"ABC", "DEF"} }
Produces: XS7036, There is no argument given that corresponds to the required formal parameter 'value' of 'System.Collections.Generic.Dictionary<string, string>.Add(string, string)'
from xsharppublic.
Note that List{} {1,2,3}
does not work.
Instead, it was necessary to write it as List<INT>{} {1,2,3}
Did some other change cause that? Or was it never working?
from xsharppublic.
I am not sure if this never worked. It is very well possible that we "broke" this to allow support for literal VO style arrays.
from xsharppublic.
C# also requires the type argument. This also produces the error message about the type being required:
var l = new List() { 1, 2, 3 }; // Using the generic type 'List' requires 1 type arguments
I think this is solved now. Thanks !
from xsharppublic.
I am sorry but I found one more thing.
Maybe it works, but I don't know the right syntax
The first sample below does NOT work, the second does.
The first sample generates the following (checked with ILSpy in C# mode):
string[,] aMulti3 = new string[2, 2];
If you omit the {2,2}
in the assignment then compiler complains "Untyped arrays are not available in the selected dialect 'Core'". Maybe we need a <STRING>
somewhere in this line, but I do not have clue where (and I don't think our customers would understand either).
FUNCTION Start( ) AS VOID
// this does not work
LOCAL aMulti AS STRING[,]
aMulti := STRING[,]{2,2}{ { "X#", "xsharp.info" }, { "C#", "microsoft.com" } }
xAssert(aMulti[1,1] == "X#")
xAssert(aMulti[1,2] == "xsharp.info")
xAssert(aMulti[2,1] == "C#")
xAssert(aMulti[2,2] == "microsoft.com")
// this works
LOCAL aMulti2 AS STRING[][]
aMulti2 := <STRING[]>{ <STRING>{ "X#", "xsharp.info"}, <STRING> { "C#", "microsoft.com" } }
xAssert(aMulti2[1][1] == "X#")
xAssert(aMulti2[1][2] == "xsharp.info")
xAssert(aMulti2[2][1] == "C#")
xAssert(aMulti2[2][2] == "microsoft.com")
RETURN
PROC xAssert(l AS LOGIC)
IF l
? "Assertion passed"
ELSE
THROW Exception{"Incorrect result"}
END IF
from xsharppublic.
Robert, support for array initializers was missing. Your sample should work now.
from xsharppublic.
Tx, I will look at this tonight
from xsharppublic.
Confirmed that this is fixed. And both the collection initializer for the first array and the constructor parameters for the second array can be written as simple as:
{{ "X#", "xsharp.info" }, { "C#", "microsoft.com" } }
So there are no type casts or anything needed. Great work !
from xsharppublic.
Related Issues (20)
- Lexer should recognize line continuation characters inside a string HOT 1
- Problems with memvar pragma option HOT 1
- Add support for late bound indexed property access HOT 1
- Problem using symbol literals #NULL_STRING, #NULL_DATE etc HOT 2
- Incorrect behavior when accessing hidden fields of another object HOT 1
- X# compliler flags -xpp1 isn't work HOT 5
- Error when debugging and executing SQL queries with the AdsSQLServer object HOT 1
- Incorrect Compiler incorrectly resolves static member of another type to SELF property when /allowdot is enabled
- A value of type array which was initialized with NULL_ARRAY loses its type information if it is determined via an ACCESS from Self:owner. HOT 1
- A single comma in a line of code causes an internal compiler error HOT 2
- DBFMEMO: Cannot use the hidden RDD parameter in DBCreate()/DBUseArea() to specify the memo RDD, while using DBFCDX/DBFNTX for the index HOT 6
- DBFBLOB: Cannot use the hidden RDD parameter in DBCreate() to specify the DBFBLOB RDD HOT 2
- DBFMEMO/DBFBLOB driver does not allow saving array to dbv
- DBFMEMO/DBFBLOB: Incompatibilities with reading array from dbv file HOT 2
- DBFMEMO: problem with BLOBImport() HOT 2
- The Use command triggers an error when the path to the dbf file contains spaces. HOT 5
- Cannot load supplemental files to cavowed.inf from an absolute or relative path HOT 1
- No compiler error when assigning OBJECT to typed var, with /vo7+ enabled HOT 1
- Internal Compiler Error with duplicate declaring of fields/memvars
- VFP: Bogus warning when calling a function with /fox2+
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from xsharppublic.