Other language features

For these language features I should probably start a JSR, however, I want the opinion of the public for it.
1) Language construct "alias"
Many classes with different names do things which are nearly 100% the same. For example the Point and Dimension classes within the AWT framework. They collect the same data, only the name is different and the method names are different.
It should be possible to make a simple base implementation of this and derive aliasses from this. This could look like:
public class SomeClass { ... }which in another file could be aliased like:
public class AnotherClass alias SomeClass;From the point of view of the point and dimension classes, the method names are also different, this could be solved by the following:
public class SomeClass {
    public void someMethod() {}
}which could be aliased like:
public class AnotherClass alias SomeClass {
    anotherMethod alias someMethod // Keeping overloads correct
}Note that an alias should be upcasted automatically but should manually be downcasted. With the addition of generics, it should give more room to decent notation.
2) Language construct "range"
Enumerations are very handy when dealing with logical named ranges such as dates and flags. However, if the range is numeric it is not possible to use a normal enum. There for my suggestion is the addition of the keyword range (a symboloc variant seems possible to me).
A n example of constructing a range could be:
public int range(20,30) somerange;Just as in the "alias" construct ranges should be upcasted automatically but should manually be downcasted.
These two constructs are used in languages like C++, ADA and others, so it is not something which isn't used.

This is going to be a large post, so hang tight!
As the first reply talks about interfaces I give you partially credit, but that is not the reason why I suggested the "alias" key word.
Suppose we have a highly simplified version of the Point and Dimension classes which these days look the following:
// Point class
public class Point {
    private int x = 0;
    private int y = 0;
    public void setLeft(int left) { x = left; }
    public void setTop(int top) { y = top; }
    public int getLeft() { return x; }
    public int getTop() { return y; }
// Dimension class
public class Dimension {
    private int x = 0;
    private int y = 0;
    public void setRight(int right) { x = right; }
    public void setBottom(int bottom) { y = bottom; }
    public int getRight() { return x; }
    public int getBottom() { return y; }
}As you will notice, the classes core code is exactly the same. However, the methods in Both classes will fill memory. This could be eliminated when using the "alias" keyword. The following code represents my idea behind this.
// Class representing the calculation logic of both Point as Dimension
// It seems feasible to have a construct that the class should always have to be
// used with an alias type, therefor, I typed "abstract alias".
abstract alias class XY {
    private int x = 0;
    private int y = 0;
    public void setX(int x) { this.x = x; }
    public void setY(int y) { this.y = y; }
    public int getX() { return x; }
    public int getY() { return y; }
// Point class, alias for  XY
public class Point alias XY {
    setLeft alias setX;
    setTop alias setY;
    getLeft alias getX;
    getTop alias getY;
// Dimension class
public class Dimension alias XY {
    setRight alias setX;
    setBottom alias setY;
    getRight alias getX;
    getBottom alias getY;
}I hope this will clear things up a little bit. These are only changes to the name of the method and the class, not to the implementation of it. They should become double references to the same methods.
The second feature I suggested, the range feature would indeed be an infrigement to the compatibility to older classes which may use the range as a regular name. Here I will give a try again.
int (20...30) limited;In this case a new primitive is created called limited, which is almost exactly the same as the int promitive, but can only store 20 through 30 to it. The following code demonstrates the idea behind it.
int (20...30) limited;
// use limited
public void mainMethod() {
    limited foo = 25; // Compiles OK
    foo = 35; // Fails to compile
    int bar = foo; // Compiles OK
    foo = bar; // Fails to compile
    foo = (foo)bar; // Compiles ok, would throw a runtime exception when bar < 20 or > 30
}I hope this demonstrates the usage.
The suggestion about the "with" keyword is not really clear to me. Is it used to use bean-like methods as properties? If it is so, then you should know that this is already made possible using meta-attributes. If it is used to get rid of the notation of the variable, I would doubt if it improves readability, but hey, that is my opinion.
Greetings,
Sjoerd

Similar Messages

  • Finally support of other languages in forthcoming Leopard?

    Does anyone know if Leopard will finally support other languages than English as well? I want to buy my parents a Mac and VoiceOver would be perfect for them if only Mac OS X would support German.
    Leopard is said to have a new voice technology, but I could not find out if this is restricted to English again.
    Why is an important feature like this not localized? Does anyone know the background?

    Hello Thomas,
    I've had a lot of success with Macs running Tiger in French, with added voices from Infovox iVox. The easiest way to get these is to buy VisioVoice from Assistive Ware — the language packs are bundled and include American English, British English, American Spanish, Canadian French, French, German, Italian, Dutch, Flemish, Spanish, Portuguese, Brazilian Portuguese, Danish, Norwegian, Finnish and Swedish.
    There might be odd problems with non-localised voice tags, but you can usually kludge these using the VoiceOver pronunciation dictionary—with care!
    Other voices are available from Cepstral. Listen to samples from both sites, and see what you prefer. I'm aware that buying extra voices is an additional cost, but compared to the cost of Windows screen readers, this is trifling.
    As for Leopard, it certainly promises full localisation not only of the OS but also of VoiceOver. I don't know what other languages may be delivered with machines or local distributions of Leopard for installation on existing kit, but third-party voices shouild work just fine.
    Don't hesitate! Go for it! You won't be sorry!
    Archie

  • To see reviews in other languages

    Hi there!
    I have a suggestion for the iTunes store / App store: please let the user see reviews in other languages. When your language is other than English, many products  have (almost) no reviews available, and you wish you could at least see those available in other languages you know. This feature would be so easy to add. Thanks!
    Tron

    Hi;
    Please check below and see its helpful:
    Oracle Reports Documentation
    http://www.oracle.com/technology/documentation/reports.html
    Oracle Forms Developer and Forms Server Documentation
    http://www.oracle.com/technology/documentation/forms.html
    Oracle Reports
    http://download.oracle.com/docs/cd/B14099_19/bi.1012/b14364.pdf
    Regard
    Helios

  • Speech transcription in other languages.. not english

    hello,
    in my speech transcription options.. is enabled only in English but in no other language .. as Spanish, which is what I need. The video interview is in Spanish. I tried reinstalling the program .. but does not work .. what may be happening? option works only in English .. all others are grayed out .. disabled. help please!

    Harm Millaard wrote:
    Since it does not even work in English, I would not worry about the lack of other languages. It probably was a very, very bad effort from a former Dragon employee to get it included in CS4. I just hope they leave it out in CS5, because it only bloats the software without any benefit at all.
    Its far from perfect, and I have no use for it myself.  BUt there are are users who like this feature and even in its imperfect state saves them time in their workflow.  Imagine doing a docu with 90 minutes of talking heads and three camera angles.  Searching for a word or phrase by scrubbing would take a long time.  Searching by text is almost instantaneous.  The transcription isnt perfect but it often is close enough to be helpful in this workflow.
    Useless for many perhaps; but useful for some.

  • Why can't ibook give meaning of words in other languages like Arabic?

    Why can't ibook give meaning of words in other languages like Arabic?

    Nobody in these forums can tell you why some feature you want is not yet available, but you can ask for it here:
    http://www.apple.com/feedback/

  • Can I get dictionaries for iBooks in other languages?

    It's a great feature in iBooks that I can mark a word I don't know and get an explanation from the built-in dictionary.
    And it would even greater to get the same support for other languages (e.g. french). Is that possible?

    Currently only English and Japanese have built-in support for looking-up words - you can download dictionaries from the store for other languages but they won't work in the same as those two i.e. you'd need to go into the book/dictionary yourself and find the definition.

  • Will other language will be in playbook

    hi 
    will the other language will be in playbook soon like arabic ?! 

    Hi,
    This feature is currently unavailable on the BlackBerry PlayBook. Keep checking www.blackberry.com/bbm for updates.
    Thank you
    -DrP
    Come follow your BlackBerry Technical Team on Twitter! @BlackBerryHelp
    Be sure to click Kudos! for those who have helped you.
    Click Solution? for posts that have solved your issue(s)!

  • New language feature: lazy local pattern matching

    <p>In the upcoming release of the Open Quark Framework, CAL gets a new language       feature: lazy local pattern matching.</p> <p>The new local pattern match syntax allows one to bind one or more variables to       the fields of a data constructor or a record in a single declaration inside a       let block.</p> <p>      For example:</p> <p>      // data constructor patterns:<br />      public foo1 = let Prelude.Cons a b = ["foo"]; in a;<br />      public foo2 = let Prelude.Cons {head=a, tail=b} = ["foo"]; in a;<br />      <br />      // list cons patterns:<br />      public foo3 = let a:b = [3]; in a;<br />      <br />      // tuple patterns:<br />      public foo4 = let (a, b, c) = (b, c, 1 :: Prelude.Int); in abc;<br />      <br />      // record patterns:<br />      public foo5 = let = {a = "foo"}; in a; // non-polymorphic record pattern<br />      public foo6 = let {_ | a} = {a = "foo", b = "bar"}; in a; // polymorhpic record       pattern<br />      <br />      Whereas a case expression such as (case expr of a:b -> ...) forces the       evaluation of expr to weak-head normal form (WHNF), a similar pattern match       declaration (let a:b = expr; in ...) does not force the evaluation of expr       until one of a or b is evaluated. In this sense, we can regard this as a form       of lazy pattern matching.<br /> </p> <p>Thus,</p> <p>      let a:b = []; in 3.0;</p> <p>is okay and would not cause a pattern match failure, but the case expression</p> <p>      case [] of a:b -> 3.0;</p> <p>would cause a pattern match failure.</p> <p>This laziness is useful in situations where unpacking via a case expression may       result in an infinite loop. For example, the original definition of List.unzip3       looks like this:</p> <p>// Original implementation of List.unzip3<br />      unzip3 :: [(a, b, c)] -> ([a], <b>, [c]);<br />      public unzip3 !list =<br />          case list of<br />          [] -> ([], [], []);<br />          x : xs -><br />              let<br />                  ys =       unzip3 xs;<br />              in<br />                  case x       of<br />                  (x1,       x2, x3) -><br />                      //do       not do a "case" on the ys, since this makes unzip3 strictly evaluate the list!<br />                      (x1       : field1 ys, x2 : field2 ys, x3 : field3 ys);<br />              ;<br />          ;<br /> </p> <p>The use of the accessor functions field1, field2 and field3 here is necessary,       as the alternate implementation shown below would result in "unzip3 xs" to be       evaluated to WHNF during the evaluation of "unzip3 (x:xs)". Thus if the input       list is infinite, the function would never terminate. </p> <p>// Alternate (defective) implementation of List.unzip3<br />      unzip3 :: [(a, b, c)] -> ([a], <b>, [c]);<br />      public unzip3 !list =<br />          case list of<br />          [] -> ([], [], []);<br />          x : xs -><br />              let<br />                  ys =       unzip3 xs;<br />              in<br />                  case x       of<br />                  (x1,       x2, x3) -><br />                      case       ys of // the use of "case" here is inappropriate, as it causes "unzip3 xs" to       be evaluated to WHNF<br />                      (y1,       y2, y3) -> (x1 : y1, x2 : y2, x3 : y3);<br />                  ;<br />              ;<br />          ;<br /> </p> <p>With the new syntax, the original implementation can be expressed more nicely       without changing its semantics:</p> <p>// New implementation of List.unzip3, revised to use the local pattern match       syntax<br />      unzip3 :: [(a, b, c)] -> ([a], <b>, [c]);<br />      public unzip3 !list =<br />          case list of<br />          [] -> ([], [], []);<br />          x : xs -><br />              let<br />                  (y1,       y2, y3) = unzip3 xs; // using a tuple pattern to perform a lazy local pattern       match<br />              in<br />                  case x       of<br />                  (x1,       x2, x3) -><br />                      (x1       : y1, x2 : y2, x3 : y3);<br />              ;<br />          ;<br /> </p> <p style="text-decoration: underline">It is important to note that in places where       a case expression can be used (without having an unwanted change in the       laziness of the expression being unpacked), it should be used instead of this       local pattern match syntax.</p> <p>Things to note about the new syntax:</p> <p>      - local type declarations on the pattern-bound variables are allowed, and these       type declarations can have associated CALDoc comments. On the other hand, the       actual local pattern match declaration itself cannot have a type declaration       nor a CALDoc comment.</p> <p>      - this syntax cannot be used for top-level definitions, only local definitions       in let blocks</p> <p>      - one cannot use patterns with multiple data constructors, e.g.</p> <p>      let (Left|Right) = ...;</p> <p>      is not allowed</p> <p>      - one cannot specify a variable for the base record pattern, e.g.</p> <p>      let {r | a, b} = ...;</p> <p>      is not allowed, but this is okay:</p> <p>      let {_ | a, b} = ...;</p> <p>      - patterns without no variables are disallowed, e.g.</p> <p>      let _ = ...;<br />      let [] = ...;<br />      let () = ...;<br />      let : = ...;<br />      let {_|#1} = ...;      <br /> </p>

    If you use just / it misinterprets it and it ruins
    your " " tags for a string. I don't think so. '/' is not a special character for Java regex, nor for Java String.
    The reason i used
    literal is to try to force it to directly match,
    originally i thought that was the reason it wasn't
    working.That will be no problem because it enforces '.' to be treated as a dot, not as a regex 'any character'.
    Message was edited by:
    hiwa

  • Q: new language features and JVM 1.4

    I just finished reading Joshua Bloch's article on new Java language feature and am looking forward to their introduction.
    Will programs compiled using the new features (generics, enhanced for, autoboxing, enums, static imports, and metadata) still run under a JVM 1.4?
    I understand that a program that uses new gizmos from Swing, etc. will NOT run, but how about these language features?
    Thanks, Ralph

    Objects you would like to use in the new for loop syntax must be >instances of the Iterable interface which will be added to the >java.lang package. The Collection interface will extend Iterable. This >will allow arbitrary type to be used in the new for loop without
    having to extends Collection. ah ok, why is this needed over doing plain syntactical transformations at compile-time e.g.
    for( o : myarray ){
    code
    goes to
    for(int i=0; i<myarray.length; i++){
    Object o = myarray<i>;
    code
    or
    for( o : myCollection ){
    code
    goes to
    for(Iterator i = myCollection.iterator(); i.hasNext(); ){
    Object o = i.next();
    code
    (I don't see why typing the element holder couldn't be automated too?)
    asjf

  • JSAPI - other languages than English; MIDlet - settings loading; JSAPI - al

    Hello!
    I need to create application which uses speech recognition. At first I thought about using CMU Sphinx (PocketSphinx or, possibly, Sphinx4). Later I thought about JSAPI. (Sphinx somehow uses JSAPI but I don't know what is the difference between JSAPI and Sphinx).
    I have read almost all (up to 6.7.9) of the following tutorial: http://java.sun.com/products/java-media/speech/forDevelopers/jsapi-guide.pdf. Unfortunately I couldn't've found one important thing, i.e. how to create acoustic model for other language than English?
    Thanks in advance for your answers :-)!
    PS There are some other things which I'd like to know:
    1) How to load some settings from file (I guess nowadays configuration files are created with the use of XML but I dunno)?
    2) How to maintain algorithm which is used by MIDlet which involves JSAPI? I mean there are some different things which my MIDlet needs to do. I guess it is good habit to divide different goals into separate parts of code (due to object-oriented programming).
         In my case there are some different things:
         a) speech recognition of audio input, i.e. changing input audio stream into output text string
         b) analysis of that text string and according to this string choosing the proper transition in my algorithm
         In general I have written my algorithm on sheet of paper and it takes about ten A4 sheets of paper. Because of it I thought there should be some way to write this algoritm maybe outside the code, in some kind of file which would contain this algorithm. Maybe there is other good way to implement this algorithm, not necesarilly in the code.
         c) sending of results through httpconnection with the use of POST method
         d) receiving in on TomCat on server
    3) Which method should I use to receive the recognized speech? I found these:
         a) FinalRuleResult, b) Result -> getBestToken, c) getSpokenText, d) ResultToken of RuleGrammar
    4) Can you give me any full examples of JSAPI usage? (Not just short parts of code like in this JSAPI guide)?
    Greetins :-)!

    Praveen, Yes the infoobject is language dependent.  The problem did not happen in BWQ but came up in BWP.  so I am not sure at this time what is causing in production that didn't happen in BWQ.
    Thanks,
    Syed.

  • B2Bconsole in any other languages than English?

    Does anyone know if there is a civilised way to localize the B2Bconsole GUI, to display in any other language than English?
    I have found no documentation nor settings, and not sure if there is any way to do it (except for decompiling the orignal one, or writing you own console...).
    thanks,
    Norbert

    Dheeraj,
    Sincerelly, I don't think you will have prepared translation to Polish , but maybe? If not, is there any possibility to create such a translation oneself?

  • I installed elements 12, it won't open, a screen pops up with options for e-12 and 4 other language

    I installed elements 12, it won't open, a screen pops up with options for e-12 and 4 other languages.  When I click Elements 12 a screen pops up with a red install icon, I click it and it askes for the serial number. It won't let me type in letters only numbers. I already did the serial number once. How do I get this to work? I don't want to be a programer!  

    attach a screenshot of what pops up after clicking pse 12, http://forums.adobe.com/thread/963429

  • How i can copy the script from one language to other language

    dear all,
    how can i copy script i.e i changed =in EN, but i want copy convert same effects in DE (from one language to other language but not all language)

    hi,
    From the SAP standard menu, choose SE71.
    On the Form Painter: Request screen:
    1)Enter the name of the form (ZORDER01) in the Form field.
    2)Enter DE in the Language field.
    3)Click created and press OK.
    4)From menu bar, choose form->copy from
    5)In the popup, give formname as (ZORDER01) and language as EN and click ok.
    6)Save the form and activate it.
    Regards,
    Sailaja.

  • How can I turn off other languages on my ipad running ios7?  It has Japanese or Chinese and the international keyboard is set to English.  Thank you.

    How can I turn off other languages on my ipad the next generation running ios7?  I have the international language set to English but it's showing a foreign language and sometimes it shows the foreign language with English.  Thank you.

    The complete backup and restore procedure is explained in the link above.
    If you don't want to do a restore, then your iPad may remain in the unstable state you have for the moment.
    You can change the country in the App Store. Have a look at the bottom of the App Store screen, you can change the country and also do the permanent change via Manage > Account.
    You can change the language in iTunes via General Preferences > under General tab.

  • HT204411 iTunes store - I live in the German speaking part of Switzerland (and have a credit card address here too) but want to watch films in English, Italian, or French. Why are films not available in these other languages ?

    Hello, I live in the German speaking part of Switzerland (and have a credit card address here too) but want to watch films in English, Italian, or French. Why are films not available in these other languages ? Unless I am mistaken, iTunes Switzerland is far from Swiss and does not encourage its people to watch films in the local languages of its country (at least French and Italian would be good too...). Can anyone help ? Do I have to move to Geneva to watch a non French film in French or Lugano to watch a non Italian film in Italian or simply buy a DVD to get round it?

    I have the same problem. I want to watch any movies in French (in the original, or subtitled and/or dubbed). But I cannot seem to find any on iTunes. Does iTunes offer any content in other countries (I live overseas) in the languages of those countries?

Maybe you are looking for

  • Remote and Motorola DVR Problems

    I was connected to fios internet and tv on March 5, I have called tech support at least 8 times about the remote not working . I have had 3 boxes and 2 remotes sent to me and I still have the problem . I have a Sony Bravia LCD 40" TV The first box wa

  • Can i print from iPad wireless to my printer w/o getting an Air printer?

    I have a router that can print from my PC or from my Lenovo laptop wirelessly to a Canon printer that is wired to the router via an ethernet cable. is there some way to get the iPad to see the printer without having to buy on of those Air Printers? i

  • Can Acrobat 9 pro be installed to XP with web server(IIS) without any license issue?

    It seems not to permit to install into window server, but how about the window XP had web server installed?

  • 2007 MBP3.1 17" won't accept blank CD-R's

    Hi, My 17" late '07 MacBook Pro won't accept blank CD-R's any more. A couple of days ago it worked fine, now all of a sudden ALL blank CD's are (r)ejected. Blank DVD's are not a problem, nor are music cd's and dvd's with data or movies. What might be

  • ABAP Webservice Call issue

    Hi I am trying to use webservice from ABAP ECC to external server (Webspehere ). I have configured RFC connection G Type HTTP connection to external server in SM59. Connection sucessfull.we use basic authentication scheme to access external server. I