BookRags.com Literature Guides Literature
Guides
Criticism & Essays Criticism &
Essays
Questions & Answers Questions &
Answers
Lesson Plans Lesson
Plans
My Bibliography Periodic Table U.S. Presidents Shakespeare Sonnet Shake-Up
Research Anything:        
History | Encyclopedias | Films | News | Create a Bibliography | More... Login | Register | Help
Not What You Meant?  There are 13 definitions for Chrome.

Chrome (programming language)

Print-Friendly
About 2 pages (556 words)

Bookmark and Share Questions on this topic? Just ask!
Chrome
Image:Chrome-150-White.png
Developer RemObjects Software
Latest release 2.0.5.431 / October 25, 2007
OS Common Language Infrastructure
Genre Programming Language
License Commercial
Website Chrome Homepage

Chrome is a programming language for the Common Language Infrastructure developed by RemObjects Software. Chrome is Object Pascal based. Compared to Delphi.NET, developed by Borland, Chrome does not emphasize total backward compatibility. RemObjects Software offers full integration into Visual Studio 2003/2005/2008. There is no stand-alone Chrome IDE.

Contents

Features

Code examples

Hello World

<source lang="pascal"> namespace HelloWorld;

interface

type

 HelloClass = class
 public
   class method Main; 
 end;
 

implementation

class method HelloClass.Main; begin

 System.Console.WriteLine('Hello World!');

end;

end. </source>

Generic container

<source lang="pascal"> namespace GenericContainer;

interface

type

 TestApp = class
 public
   class method Main;
 end;
 
 Person = class
 public
   property FirstName: String;
   property LastName: String;      
 end;        

implementation uses

 System.Collections.Generic;

class method TestApp.Main; begin

 var myList := new List<Person>; //type inference
 myList.Add(new Person(FirstName := 'John', LastName := 'Doe'));  
 myList.Add(new Person(FirstName := 'Jane', LastName := 'Doe'));
 myList.Add(new Person(FirstName := 'James', LastName := 'Doe'));  
 Console.WriteLine(myList[1].FirstName);  //No casting needed
 Console.ReadLine;        

end; end. </source>

Generic method

<source lang="pascal"> namespace GenericMethodTest; interface type GenericMethodTest = static class public

 class method Main;

private

 class method Swap<T>(var left, right : T);
 class method DoSwap<T>(left, right : T);

end; implementation class method GenericMethodTest.DoSwap<T>(left, right : T); begin

 var a := left;
 var b := right;
 Console.WriteLine('Type: {0}', typeof(T));
 Console.WriteLine('-> a = {0}, b = {1}', a , b);
 Swap<T>(var a, var b);
 Console.WriteLine('-> a = {0}, b = {1}', a , b);

end; class method GenericMethodTest.Main; begin

 var a := 23;// type inference
 var b := 15;
 DoSwap<Integer>(a, b); // no downcasting to Object in this method.
 var aa := 'abc';// type inference
 var bb := 'def';
 DoSwap<String>(aa, bb); // no downcasting to Object in this method.
 DoSwap(1.1, 1.2); // type inference for generic parameters
 Console.ReadLine();

end; class method GenericMethodTest.Swap<T>(var left, right : T); begin

 var temp := left;
 left:= right;
 right := temp;

end; end. </source> Program Output:

Type: System.Int32
-> a = 23, b = 15
-> a = 15, b = 23
Type: System.String
-> a = abc, b = def
-> a = def, b = abc
Type: System.Double
-> a = 1,1, b = 1,2
-> a = 1,2, b = 1,1

Enhanced case statements

<source lang="pascal"> case aClassID.ToUpper of

  'XYZ': result := TMyXYZClass;
  'ABC': result := TMyOtherClass;

else raise new Exception('Invalid Class ID'); end; </source> <source lang="pascal"> case aClass type of

  TMyXYZClass: TMyXYZClass(aClass).DoSomething;
  TMyOtherClass: TMyOtherClass(aClass).DoSomethingElse;

else raise new Exception('Invalid Class Reference'); end; </source>

See also

External links

View More Summaries on Chrome (programming language)
 
Ask any question on Chrome (programming language) and get it answered FAST!
Answer questions in BookRags Q&A and earn points toward
discounted or even FREE Study Guides and other BookRags products!
Learn more about BookRags Q&A
Copyrights
Chrome (programming language) from Wíkipedia. ©2006 by Wíkipedia. Licensed under the GNU Free Documentation License. View a list of authors or edit this article.

Article Navigation
Join BookRagslearn moreJoin BookRags




About BookRags | Customer Service | Report an Error | Terms of Use | Privacy Policy