.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  
Silverlight  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
ASP Web Hosting  
ASP.NET Web Hosting 
Windows Web Hosting
 
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 / 17
    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

    - Building Applications with Windows Workflow ...
    - Building the Data and Business Layers Using ...
    - The Transformed XML Explorer in MFC
    - List Control and Property Grid with the MFC ...
    - Font, Shell and Masked Edit Controls for MFC
    - Color, Link and Image Editor Controls for M...
    - New Controls for MFC
    - The Windows Ribbon Framework
    - Markup Language for the Ribbon Framework
    - Visually Upgrade Your MFC Project
    - New Features for the Statusbar in MFC
    - Working with the Statusbar in MFC
    - Iron Speed Design v60 Review
    - Binary and XML Serialization
    - Using CrystalReportViewer to Display Crystal...





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 3 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek