
A scheme that avoids having to declare the command multiple times is the main thing I think because it will make the file much less readable... And break my documentation parser...
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, LCMark
Code: Select all
implements revdb-driver for database-type "jdbc" using java
wasn't that mergPanCake ?mergPopToast.... mmm... yum
In the current context, my suggestions about an 'if' clause were just to get lcidlc working well enough to allow android externals now - to be fair, in this interim period it probably isn't necessary (although see below...). This also why I'm talking in terms of Android externals and not Java more generally at the moment.A scheme that avoids having to declare the command multiple times is the main thing I think because it will make the file much less readable... And break my documentation parser...
This is essentially what I was talking about above post-lcidlc. The 'script level' spec (which will eventually include syntax and docs) represents the 'interface' of the module - it is then up to the engine to determine what language the implementation is in, do the relevant type mapping and call the appropriate method using the appropriate language runtime. i.e. You specify the interface to script once, and then the 'script-level' methods are bound to their 'native' implementations (whether that be C/C++/Obj-C, Java or some other language).Look at it this way: 'revdb' would be an 'interface' module, with multiple 'implementation' modules.
Yes - Java strings (at the moment) work just like NSString's do for iOS externals - the generated code converts the native encoding to a Java string, just like it converts the native encoding to an NSString. Post-lcidlc it becomes completely transparent...BTW I see what's going on now with character encoding for java strings... so I guess it's equivalent to NSString... what I find a bit annoying is in order to use unicode strings we need to use c-data and convert to a known encoding... also we probably need to create variants of our commands that require unicode... or add an encoding parameter to each command... is there any way we can make this whole thing more transparent on both the scripter side and the external side?
There's no need for this... At the script-level you specify a method as taking a 'string' - this is an abstract concept meaning a sequence of characters. It is in the implementation methods that a particular type of string will be presented as an argument. For example, in the C bindings you'll be able to specify these:We ought to standardize on UTF-8 when crossing the boundaries from LiveCode to other technologies (be it C, Java or C#).
Or maybe the .lcidl definition could be expanded with an encoding clause at the same level as the use clauses?
UTF-8 is an implementation detail - it isn't something that most people will want to deal with at the script level. In particular, UTF-8 is a multibyte encoding - if 'char' at the script level were a UTF-8 char then *all* string operations become O(n) (i.e. proportional to the length of the string) rather than O(1) (i.e. constant time). Now, it is true that UTF-16 is also a multi-byte encoding, but mostly not - if a UTF-16 string does not use surrogates then it's a 1-1 mapping and so 'char <n> of ...' remains constant time. The point is that we are a high-level language so really, at that level strings should be sequences of (indivisible) chars - the only time you should ever need to be concerned about encodings is when performing I/O (where you need to represent the 'abstract' notion of string in some concrete form).I wish the whole platform would standardise to UTF8. I never understood why our unicode implementation in such a cross platform tool was one that required byte ordering rather than one that was totally cross platform but I guess that ship has sailed.
This was the motivation for suggesting an 'if' clause... As mentioned before, there's a difference between 'script' level types and 'native' types - at the script level there is only the concept of 'string', at the native level what a 'string' needs to be passed as can and will vary. On iOS, you might want it as an objc-string or a c-string, whereas for Android (Java) you will want it as a Java string.OK so now that I've implemented the fairly trivial example (mergPopToast)... I did this in the revtestexternal... I'd like to integrate that into my currently iOS only mergPop external. In this case this external would have a set of iOS only commands and an android only command.. I guess I could make a completely separate external but the command fits the general function of the external.
Code: Select all
command foobar
on ios, mac use objc
on android use java
on windows, linux use c
in a as string
in b as data
in c as array
in d as dictionary