.NET
  Home arrow .NET arrow The Delphi Language, Part 1
ASP Free Forums 
.NET  
ASP  
ASP Code  
ASP.NET  
ASP.NET Code  
BrainDump  
C#  
Code Examples  
Database  
Database Code  
IIS  
Microsoft Access  
MS SQL Server  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
ASP Web Hosting  
ASP.NET Web Hosting 
Mobile Linux 
App Generation ROI 
Windows Web Hosting
 
IBM® developerWorks 
Sun Developer Network 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
.NET

The Delphi Language, Part 1
By: Xavier Pacheco
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 16
    2004-07-07

    Table of Contents:
  • The Delphi Language, Part 1
  • Procedures and Functions
  • Constants, Operators
  • Delphi Language Types
  • Variant Types
  • Variants in Expressions
  • Arrays
  • Records and Sets
  • Pointers
  • Classes and Objects

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    The Delphi Language, Part 1


    (Page 1 of 10 )

    The book Delphi for .NET Developer's Guide, by Xavier Pacheco, (Sams, ISBN: 0-672-32443-1, 2004) includes this chapter by co-author and Delphi expert Steve Teixeira. This part of the chapter covers types of comments, parentheses in calls, default value parameters, Delphi language's structured style of variable declaration, differences between C# constants and Delphi constants,  operators, variants, arrays and records and how Delphi's strongly-typed nature enables it to perform a sanity check of your code.

    delphiThis chapter covers Delphi's underlying language, Object Pascal. First, you'll receive an introduction to the basics of the Delphi language, such as language rules and constructs. Then, you'll learn about some of the more advanced aspects of the Delphi language, such as classes and exception handling. This chapter assumes that you have some experience with other high-level computer languages. Therefore, it does not teach the concepts associated with programming languages, but rather on how to express those concepts in Delphi. By the time you're finished with this chapter, you'll understand how programming concepts such as variables, types, operators, loops, cases, exceptions, and objects work in Delphi and how many of these elements relate to the underlying .NET Framework. To provide additional practical grounding, we will draw comparisons where appropriate with Delphi's more widely used .NET cousins, C# and Visual Basic .NET.

    It's All about .NET

    Delphi 8 produces applications that run completely within the context of the Microsoft .NET Framework. Therefore, the capabilities and features of Delphi 8's compiler must be subject to the capabilities and features of the underlying .NET Framework. This notion might be vaguely disconcerting for those coming into the .NET from the native code world. A native code compiler can essentially do anything it wants—its capabilities limited only by the desires of the compiler vendor. In .NET development, literally everything one might do—even something as trivial as adding two integers together—boils down to the compiler generating code that manipulates features and types of the .NET Framework.

    Rather than producing native code, a .NET compiler such as Delphi 8 produces code in a format called Microsoft Intermediate Language, or MSIL, which is the lowest-level representation of application instructions.

    Note - Chapter 2 discusses the just-in-time (JIT) compilation nature of the .NET Framework. Now might be a good time to review that information.

    Comments

    The Delphi language supports three types of comments: curly brace comments, parenthesis/asterisk comments, and double backslash comments. Examples of each type of comment follow:

    { Comment using curly braces }
    (* Comment using paren and asterisk *)
    // double backslash comment

    The first two types of comments are virtually identical in behavior. The compiler considers the comment to be everything between the open-comment and close-comment delimiters. For double backslash comments, everything following the double backslash until the end of the line is considered a comment.


    Note - You cannot nest comments of the same type. Although it is legal syntax to nest comments of different types inside one another, we don't recommend the practice. Here are some examples:

    { (* This is legal *) }
    (* { This is legal } *)
    (* (* This is illegal *) *)
    { { This is illegal } }

    Another handy technique for disabling a body of code, particularly when different kinds of comments are used in the code, is to use the $IFDEF compiler directive. For example, the following code uses $IFDEF to comment out a block of code:

    {$IFDEF DONTCOMPILEME}
    // imagine a bunch of code here
    {$ENDIF}

    Because the DONTCOMPILEME identifier is not defined, the code inside the $IFDEF is effectively commented out.


    This chapter is from Delphi for .NET Developer's Guide, by Xavier Pacheco (Sams, 2004, ISBN: 0-672-32443-1). Check it out at your favorite bookstore today.

    Buy this book now.

    More .NET Articles
    More By Xavier Pacheco


     

    .NET ARTICLES

    - Using CrystalReportViewer to Display Crystal...
    - Creating Summary .Net Crystal Reports
    - More on Commands, Input and the WPF
    - Grouping and Aggregating When Querying LINQ ...
    - Commands, Input and the WPF
    - Keyboard and Ink Input with WPF
    - Mouse Input and the WPF
    - Input with Windows Presentation Foundation
    - Introducing LINQ with XML and Databases
    - An Introduction to LINQ
    - Querying LINQ to SQL: Basics
    - Completing a Simple Storefront with LINQ
    - Knowing Your Environment: the System.Environ...
    - Creating the Home Page for a Simple Storefro...
    - LINQ Quickly with Language Integrated Queries





    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway
    Stay green...Green IT