If you were going to add to the Xojo language

In Xojo just use an in-memory SQLiteData base…

If you wanted to, you could probably write an Xojo API to make using it that way easier, if setting it up manually each time is too much of a hassle.

-Karen

1 Like

Additional types, while they can be “created” in Xojo, are nice to have native, like Stacks and ArrayLists. (I know there’s others, but can’t think of them atm)

This is where Generics would play a big role
In C++ templates (their version of generics) led to a hge body of work creating STL - the standard template library - as so many data structures and types are defined not in terms of the data they hold (strings, ints, etc) but by the operations that are possible on the data structures
This would be a pretty significant addition and would permit a common library of such things to be created for Xojo
Many other language support notions that are very similar and are extremely useful

I have a question regarding something that keeps being promised to be added officially but appears to be thrown down the back of the sofa repeatedly.

what would a plugin be to Xojo that we do not have right now, and what actually is a plugin in this instance.

is it indeed a thing to add to the language?

This is sort of a multipart question

The way they are handled in xojo is as new “frameworks” (sets of classes method namespaces etc) that are loaded and are available to your code. How thats done is immaterial to thats basically whats going on.

They dont add to “the language” - ie/ not in the sense that they add terms like IF THEN END SELECT DIM REDIM #pragma etc

This is why I say the easiest way to know what is part of the core “language” is to try something in IDE script / Xojo Script. if it works there its almost assuredly part of the language. If it doesnt then its probably part of a framework either the Xojo one or from a plugin etc.
Folderitem wont work in XojoScript / IDE script - its a set of classes that are part of the default framework Xojo provides for users. But its not “the language”
DIM works because it is part of the core language

Honestly, I’m fine with the language the way it is. I would just like the damn IDE to be fixed to make it work properly like Real Studio.

6 Likes

You’re probably right. Anyway, all these proposed changes make the language more professionally-oriented, and we all know how Xojo feels about that.

1 Like

few so far would alter the language in a way you would have to know them or use them

in C you can use prefix and suffix forms of ++, or +=, or what you currently use in Xojo
they all work

     int i ;

     ++i ;

     i++ ;

     i+=1 ;
   
     i = i + 1;

they all have the same effect
some do have specialty uses and side effects - but again no one is required to use them that way

++i is not the same as i++ depending on the context in which it appears.

if they both appear as a single statement, then yes they are identical in results produced

1 Like

support of specific escaped characters in a string

s="this is line1 \n this is line2"

\n \r \t at least

1 Like

The “smart string” literal like in B4X: it is a more powerful version of the standard string literal.
It has three advantages:

Supports multi-line strings.
No need to escape quotes.
Supports string interpolation.

The smart string literal starts with $" and ends with "$.

Very handy for.e.g. building html strings.

example:

Dim mName as string = "myID"
...
Dim mElement as String = $"
		<div id="${mName}overlay" class="bansk-overlay u-hide"></div>
		<div class="bansk-sidebar u-hide ${LeftRight} ${mClasses}" style="${mStyle}" id="${mName}"></div>
"$

Much more readable than having to use + to concatenate, and less susceptible to typos. A real time saver I must say.

3 Likes

And just this simple example shows me I wouldn’t want this in Xojo. Sure, I can not use it myself, but debugging others’ code or even helping someone (e.g. in a forum) if they start using these syntaxes with possible side or “unexpected” effects would be harder.
Xojo already can do such maths; why adding operators which do the same?

1 Like

I like the ease of typing i++ but I prefer the clarity of reading i = i +1.
I think that one of the plus points of BASIC-inherited Syntax is the verboseness of almost clear English. Any abbreviated Syntax forces the user to learn a completely different language style and, at least for some time, to translate the meaning each time he reads such a line.

For such cases, I really like how Julien‘s ReformatCode works. I can type a C-like addition and it will translate into normal Xojo code automatically.

2 Likes

I am not advocating that ++ or – in any variation be added, but += and -= would be nice as they are not ambiguous

I think other langs call this string interpolation

JS and .NET have a similar functionality that I miss.
.NET has 2 forms:

Dim num = 1.2345
Debug.WriteLine($"This number is {num:0.00}") // shows This number is 1.23
Debug.WriteLine($"This number is {0:0.00} and {1:0}", num, 5.44) // shows This number is 1.23 and 5

Also has multi-line string literals.

In Swift you can do this

s="This is how to print \(aString) inside another \n with a 2nd line and \u{1f41e} a bug"

B4X van also do such number/date/…formatting in its smart strings. Seems most languages can do this nowadays, hence my suggestion for the Xojo language.

1 Like

I agree they are not ambiguous to me: I don’t know what they mean, so I can’t confuse…

+= means add the value on the right side to the value of the variable on the left side, and store it to the variable on the left side.

n += 1 means add 1 to n, and store it in n. Equivalent to n = n + 1

2 Likes