From: Ben B. <ba...@de...> - 2003-06-26 01:04:18
|
Hi. > > On the other hand, if the variables were public, > > there would be even less java-functions (e.g. > > setReadlineVar(INHIBIT_COMPLETION,INHIBIT_COMPLETION_TRUE)) > > This solution looks nicer to me, but then again that's just me. > Although I'd be tempted to use java native types for the values, e.g., > > setReadlineVar(INHIBIT_COMPLETION, true) > > These should be easy to convert in the .c file in the few cases where > the compiler doesn't do it automatically. I wouldn't mind having this working well before debian 3.1 is released, since I'd then like to update jython to use these patches and so on, with the ultimate aim for jython users to be able to use tabs at the jython command prompt. If you like I'd be happy to implement this, as either: (1) void setReadlineIntVar(int which_variable, int value); int getReadlineIntVar(int which_variable); void setReadlineStrVar(int which_variable, String value); String getReadlineStrVar(int which_variable); public static final int INHIBIT_COMPLETION; public static final int BASIC_QUOTE_CHARACTERS; (etc etc) (The rationale for splitting into int and str routines is because even though you could potentially overload setReadlineVar(), you could not overload getReadlineVar() in this way.) or (2) void setReadlineVar(IntVar which_variable, int value); void setReadlineVar(StrVar which_variable, String value); int getReadlineVar(IntVar which_variable); String getReadlineVar(StrVar which_variable); public static final IntVar INHIBIT_COMPLETION; public static final StrVar BASIC_QUOTE_CHARACTERS; (etc etc) This solution allows the single getReadlineVar() / setReadlineVar() syntax to be used, and the user need not even know about the different type-specific classes IntVar, StrVar, etc.: setReadlineVar(INHIBIT_COMPLETION, true); The IntVar and StrVar classes are empty classes that simply allow the compiler to handle the overloading of getReadlineVar() with different return types. My preferred solution is (2), simply because it's simpler from the user's point of view. Is this okay with you? Ben. |