The Future of Programming Languages

Note: This blog post transferred from my OLD BLOG and was originally posted in 2008.

Fascinating expert panel discussion in PDC 2008 about the future of programming from some of the leading programming languages experts in the world. How programming will be affected by a number of fundamental changes occurring like many-core machines, cloud computing, and more. What’s the biggest challenges that face the industry.

The Panel’s Speakers:

Anders Hejlsberg
Technical Fellow in the Developer Division. He is an influential creator of development tools and programming languages. He is the chief designer of the C# programming language and a key participant in the development of the Microsoft .NET framework.

Gilad Bracha
The creator of the Newspeak programming language. He is currently Distinguished Engineer at Cadence Design Systems. Previously, he was a Computational Theologist and Distinguished Engineer at Sun Microsystems. He is co-author of the Java Language Specification, and a researcher in the area of object-oriented programming languages.

Douglas Crockford
Discovered the JSON data interchange format. He is leading an effort at ECMA to develop a secure successor to JavaScript. He is the author of JavaScript: The Good Parts.

panel2PDC 2008: The Future of Programming Languages

Wolfram Schulte
A principal researcher and the founding manager of the Research in Software Engineering area, at Microsoft Research Redmond, USA. Wolfram’s research concerns the practical application of formal methods. At Microsoft, Wolfram co-lead research projects on language design and runtimes (the AsmL, Cw, TPL projects), software testing (the Pex, SpecExplorer, and nModel projects), software analysis and verification (the Spec#, Vcc and Hypervisor project), and lately on model-driven engineering of applications for the cloud (formula and bam).

Jeremy Siek
An Assistant Professor at the University of Colorado. Jeremy’s areas of research include generic programming, programming language design, and compiler optimization. Jeremy received a Ph.D. at Indiana University in 2005. His thesis laid the foundation for the constrained templates feature in the next C++ Standard. Also while at Indiana, Jeremy developed the Boost Graph Library, a C++ generic library for graph algorithms and data structures.

Topics Discussed:

panel3 PDC 2008: The Future of Programming Languages

  • What’s the biggest problem the industry facing today? and how programming languages tend to solve that?
  • What’s the difference between modeling and programming?
  • Is programming language syntax important? or it really doesn’t matter?
  • What’s the difference  between creating a new library versus creating a language extension?
  • When we’ll see Meta Programming concepts in other mainstream programming languages?
  • Is “Eval” in meta programming languages is Evil?
  • In the time of IDEs, Do languages really still matter?
  • Is C++ the universal languages that have everything you need?
  • Why we can’t evolving and show our programs in kind of structure way, to allow all sort of meta programming?
  • What’s your opinion about transactional memories and software/hardware hybrid?
  • Why keep adding things into programming languages?
  • Can structural types and type inference bridge the gap between dynamic and static language worlds?
  • Do contracts seems to be in the next generations of programming languages?
  • Why C# wants to be JavaScript?

Discussion Goodies:

  • Gilad: In today’s programming languages you can’t do the “What If” Experiences easily
  • Douglas: In late 1950 there was some work on a new concept called automatic programming, the idea behind this concept was programming is hard and we just need a higher level way to specify what need to be done and the computer can write the program for you; The result of this work was “Fortran”!
  • Douglas: Programming is so hard and we keep pushing to some place that’s not so hard, but eventually that  become programming too!
  • Jeremy: Modeling is always inherently a higher level of abstraction than programming, and it doesn’t have to be.
  • Anders : Our Brain is a pattern recognizer, and syntax is one of the patterns that we feed in.
  • Gilad: The smaller the issue the more people discuss it.
  • Douglas: We’d like to think of the process of programming language design is scientific process or at least engineering process, but it’s really all about fashion!
  • Douglas: The success of programming language has more to do with fashion than the quality of the ideas behind them, i think that’s unfortunate but i think that’s real.
  • Wolfram: If you actually  getting older you care more about the inner values of things and don’t care so much about the outer interface.
  • Jeremy: As Humans we are coming up with new notation, new abstractions, and new languages all the time. So in some sense i think when you are trying to limit that you get weird things happening.
  • Jeremy: I think we are really hurting ourselves by not allowing a full programming languages extensions.
  • Anders:  With C# 3.0 we build a DSL called LINQ.
  • Anders: I think enterprise apps today live and die by meta programming, but pretty much every app we write has some form of code generation.
  • Douglas: Eval as it currently implemented in JavaScript is clearly evil.
  • Wolfram: meta programming on the operating system level is really really a bad  idea, you don’t want to open the box.
  • Gilad: Meta programming is all about one program manipulate another, Reflection is about the program manipulating itself.
  • Gilad: It’s very important that you don’t live in this close worlds, and ideally has this kind of IDE that support multiple languages and let them interoperate.
  • Anders: Frameworks and IDEs in the terms of the learning efforts these days totally important than the languages. but that doesn’t mean that the languages is not important, they just occupy a different position in the eco system.
  • Wolfram: I think that languages and may be even the libraries doesn’t really matter so much, what you really want to see is “What’s the problem you wanna solve”, and then based on the problem you pick right languages, libraries, and IDEs.
  • Wolfram: Pick the language and IDE that is appropriate for your domain, and don’t stick to a language and use it for everything you wanna do.
  • Anders: If you looked at database system they are much more restricted on what operations you can apply to data.
  • Anders: Completely functional programming languages are outlaw of program side effects.
  • All the Speakers: Languages should be designed by dictators not by the comities!
  • Douglas: The community that uses a language is like a business, so when the language is small, experiment, and adult is like a startup. And startup is allowed to do crazy things, but once the community gets big its like a big company, And big companies have to be stagy, though it might want to claim it’s kind of innovative but it really can’t, it has to have constraint on its ability to innovate because if it gets wild it will through itself a part.
  • Douglas: The more people you have using the language, the less licenses we should have in modifying that language.
  • Douglas: Even though more people writing JavaScript than any other languages, Most of them hate it!
  • Douglas: There is no love in the JavaScript community.
  • Anders: I think it’s crazy to say every language should be static all the way down, or we should toss types. Neither are correct, it’s somewhere in between.
  • Jeremy: What we need is a gradual type system that lets you mix between real dynamic typing where the checks happen at runtime vs static typing where you actually have the checks.
  • Douglas: A few years ago dynamic languages were defiantly out of style, today they in. Sounds like Fashion to me.
  • Anders & Douglas: Learning lots of new languages is good for you, if you program mainly in one language. It makes your mind think in different way and this always help you.

I think this is a very interesting, informational, yet very funny discussion you must see if you are in the software industry.

Download TL57 Panel: The Future of Programming Languages

Hope this Helps,

Ahmed

Advertisements

Silent Overflow in CLR

Note: This blog post transferred from my OLD BLOG and was originally posted in 2007.

One of the things you want to avoid in your arithmetic operations on primitive types is the Silent Overflow , for example :

 
as you can see the value of Y is not the desired value , this is because the illegal operation on 2 different primitive types . what just happened is known as Silent Overflow , this kind of silent overflow handled in each programming language in a different way , language like C# consider this kind of overflow is not an error that’s why it allow it by default . other language like VB always consider this kind of overflow as an error and throw exception .
 
What’s matter here is the desired behavior the program need , in most scenarios you will need this kind of silent overflow not to happen in your code or you will get strange unexpected behaviors .
 
Fortunately the common language runtime (CLR) offers IL instructions that make it very easy task for each .Net language compiler to choose the desired behavior
 
add adds two values together, with no overflow checking.
add.ovf adds two values together.However,it throws System.OverflowException if an overflow occurs.
sub subtraction with no overflow checking.
sub.ovf subtract two values , throw System.OverflowException if an overflow occurs.
mul multiplication with no overflow checking.
mul.ovf multiply two values , throw System.OverflowException if an overflow occurs.
conv convert value with no overflow checking.
conv.ovf convert value  , throw System.OverflowException if an overflow occurs.

Now let’s take a closer look on how C# compiler take advantage of this set of IL instructions . first, by default C# compiler doesn’t use overflow checking instructions to run the code faster , this means that the add,subtract,multiply and conversion instruction in C# will not include overflow checking

as you can see the C# compiler generated IL uses the add instruction as it the default behavior for C# to generate silent overflow , generally you can turn that off by compile your code using the /checked+ compiler switch , which tell the C# compiler to uses the safe version of the add with overflow check , add.ovf which will prevent this kind of silent overflow and throw OverflowException if overflow occur.

Sometimes you don’t want to turn the overflow globally for the whole application , rather you want to enable it only in some places in your code that’s when checked and unchecked C# operators come into the picture .

Simply checked operator tells the C# compiler to use the safe IL instruction for this operation , and the unchecked use the normal IL instructions (which is the normal behavior in C#).

now let’s modify our simple example to use the checked operator :

using the checked operator in our example generates OverflowException because the C# Compiler generated the IL using the safe add instruction add.ovf as you can see .

C# also offers checked and unchecked statements for wider scope of overflow checking but still determined by the developer inside his/her code .

same result as you can see , OverflowException has been thrown and the generate IL uses add.ovf , just the IL get larger because the C# compiler generated more (no operation instruction nop) which you can get ride of by generating more optimized version of your app.

Hope this Helps,

Ahmed