[Info-vax] Any Way to Pass Arrays of Strings from C to Basic?
Arne Vajhøj
arne at vajhoej.dk
Sat Nov 9 18:30:19 EST 2019
On 11/9/2019 6:20 PM, Arne Vajhøj wrote:
> On 11/9/2019 12:20 PM, Dave Froble wrote:
>> Anything can be improved. However, descriptors, as a concept, are a
>> whole bunch better than not having descriptors, or something better.
>
> I agree.
>
> And it is what most modern languages do. They pass something
> that has both information about what is being passed and a reference
> to the actual data.
>
> It is not called a descriptor. But I cannot see why it should not
> be considered a descriptor.
$ type ArgDump.java
public class ArgDump {
public static void demo(Object... arg) {
for(int i = 0; i < arg.length; i++) {
if(i > 0) System.out.print(" ");
System.out.print(arg[i].getClass().getName());
}
System.out.println();
}
public static void main(String[] args) {
demo(123, "ABC");
demo(123.456);
}
}
$ javac "ArgDump.java"
$ java "ArgDump"
java.lang.Integer java.lang.String
java.lang.Double
Sure - it is called passing objects or instances of
classes.
But the concept is really the same as passing a descriptor.
Arne
More information about the Info-vax
mailing list