Giter VIP home page Giter VIP logo

Comments (8)

RobertvanderHulst avatar RobertvanderHulst commented on July 21, 2024

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.

nvkokkalis avatar nvkokkalis commented on July 21, 2024

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.

RobertvanderHulst avatar RobertvanderHulst commented on July 21, 2024

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.

RobertvanderHulst avatar RobertvanderHulst commented on July 21, 2024

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.

RobertvanderHulst avatar RobertvanderHulst commented on July 21, 2024

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.

nvkokkalis avatar nvkokkalis commented on July 21, 2024

Robert, support for array initializers was missing. Your sample should work now.

from xsharppublic.

RobertvanderHulst avatar RobertvanderHulst commented on July 21, 2024

Tx, I will look at this tonight

from xsharppublic.

RobertvanderHulst avatar RobertvanderHulst commented on July 21, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.