Welcome to the XSharp News Server and Forum

You are welcome to participate in the XSharp newsgroups and forum.

The XSharp News Server can be found at news.xsharp.info, port 119 (nntp). You can login with the user name XSharpUser and password X#Rulez!.
You can also post through the web interface. In that case you need to create a user account first.
The newsgroups and web interface are not synchronized yet. We are working on that.

When posting to the newsgroups and forums we ask you kindly to follow the rules that you can find here: https://www.xsharp.info/faq/39-xsharp-news-server-rules

× Share your code snippets, screen shots etc. here

Snippets in VS 2017 RC .... some success ....

More
1 week 11 hours ago #1 by Wolfgang Riedmann
Hi Chris,

thank you very much!

In the meantime I'll write the short form
property mySuperProp as string get self:_Get<string>() set self:_Set( value )

until the preprocessor will be available.

After I'll use it to build the correct code.

Wolfgang

P.S. the only person I would like to shoot sometimes is myself when I'm doing something really stupid (you know several samples...)

Please Log in to join the conversation.

More
1 week 11 hours ago #2 by Chris Pyrgas
Hi Wolfgang,

What you are looking for, is (generic) type inference based on the return type of the method, here's a simplified version of your code:

FUNCTION Start() AS VOID
LOCAL s AS STRING
s := TestClass.GenericMethod<STRING>() // OK
s := TestClass.GenericMethod() // error

CLASS TestClass
STATIC METHOD GenericMethod<T>() AS T
RETURN Default(T)
END CLASS

here you ask the compiler to figure out that the generic argument type of the method is STRING, because the result of that method is being assigned to a STRING var. While I agree that (in this case) it looks straightforward, type inference on return type is not supported by design (it's the same as in c#). Here is a discussion about this:

stackoverflow.com/questions/3203643/generic-methods-in-net-cannot-have-their-return-types-inferred-why

Chris

ps. please don't shoot the messenger ;-)

Please Log in to join the conversation.

More
1 week 11 hours ago #3 by Robert van der Hulst
Jack,

You are absolutely right that having a pre-processor adds a lot of power to a language.
I think that we can emulate 99% of the FoxPro syntax with the preprocessor as well.

I remember in the past, many years ago in 1993, that there was a product called the "CA-Clipper Compiler Kit for dBase IV". This product, written by Matt Whelan was using UDCs to convert dBase IV code to functions, which were then supplied in the form of a special library.

Most likely I still have a version of that (probably on 5 1/4 floppy disks), so I can have a look and use similar UDCs when we are going to add the FoxPro support.

Robert

Please Log in to join the conversation.

More
1 week 12 hours ago #4 by Jack
Thanks Robert,

Robert van der Hulst wrote: Jack,
This was probably never mentioned in the readme, since the single line property syntax is also supported b Vulcan.
You can see the EBNF notation for the property on:
http://www.xsharp.info/help/property.html
Robert

If I remember correctly the #command single line was initially shown before PPOPERTY was available in Vulcan as wrapper to ACCESS/ASSIGN to align it with the then to be released PROPERTY.

The #command was done to not have to GET _var SET _var := VALUE, but shorten it to GETSET _var.

Although thus not 100% needed for a one liner property, I still think the concept of the pre-processor is a beauty and set the Clipper based dialects far ahead of the rest of the XBase pack.

It is however good to have a discussion around it to make people aware of the power that it brings to the language. We can "emulate" many other dialect syntax that the compiler does not understand yet to produce meaningful and useful code.

Jack

Please Log in to join the conversation.

More
1 week 13 hours ago #5 by Robert van der Hulst
Jack,

This was probably never mentioned in the readme, since the single line property syntax is also supported b Vulcan.

You can see the EBNF notation for the property on:
http://www.xsharp.info/help/property.html

Robert

Please Log in to join the conversation.

More
1 week 13 hours ago #6 by Jack
Hi Robert,

Robert van der Hulst wrote: Jac,

You probably know this already, but the single line syntax for properties is already supported by the compiler:
The GET clause expects an expression, the SET clause expects an expression list.


No I have not known it, well done, good to know. Must have missed it in the "whats new" section.

Regards,

Jack

Please Log in to join the conversation.

Time to create page: 0.393 seconds