<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Observations from Uppsala &#187; python</title>
	<atom:link href="http://jakob.engbloms.se/archives/tag/python/feed" rel="self" type="application/rss+xml" />
	<link>http://jakob.engbloms.se</link>
	<description>Computer Technology: Simulation, Virtualization, Virtual Platforms, Embedded, Multicore and Multiprocessing (by Jakob Engblom)</description>
	<lastBuildDate>Sun, 29 Jan 2012 19:45:28 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
<image>
    <title>Observations from Uppsala</title>
    <url>http://jakob.engbloms.se/favicon.png</url>
    <link>http://jakob.engbloms.se</link>
    <width>32</width>
    <height>32</height>
    <description>Observations from Uppsala - http://jakob.engbloms.se</description>
    </image>		<item>
		<title>Wind River Blog Post: Scripting or Programming?</title>
		<link>http://jakob.engbloms.se/archives/1159?&#038;owa_medium=feed&#038;owa_sid=</link>
		<comments>http://jakob.engbloms.se/archives/1159#comments</comments>
		<pubDate>Mon, 28 Jun 2010 19:08:00 +0000</pubDate>
		<dc:creator>Jakob</dc:creator>
				<category><![CDATA[programming]]></category>
		<category><![CDATA[Wind River Blog]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[scripting]]></category>

		<guid isPermaLink="false">http://jakob.engbloms.se/?p=1159</guid>
		<description><![CDATA[I have a blog post called &#8220;When is Scripting Really Programming&#8221; up at the Wind River blog network. In that post, I discuss how scripting is really not clearly separated from &#8220;real programming&#8221; in the way I once believed it was&#8230; today, the line between higher-level programming languages and scripting languages look very thin in [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://jakob.engbloms.se/wp-content/uploads/2010/04/button-quicklink-blogs.png"><img class="alignleft size-full wp-image-1122" style="margin: 5px 10px;" title="button-quicklink-blogs" src="http://jakob.engbloms.se/wp-content/uploads/2010/04/button-quicklink-blogs.png" alt="" width="46" height="46" /></a>I have a blog post called &#8220;<a href="http://blogs.windriver.com/engblom/2010/06/scripting-or-programming.html#more">When is Scripting Really Programming</a>&#8221; up at the Wind River blog network. In that post, I discuss how scripting is really not clearly separated from &#8220;real programming&#8221; in the way I once believed it was&#8230; today, the line between higher-level programming languages and scripting languages look very thin in many cases. I illustrate with examples from Simics and its CLI and Python scripting systems.</p>
<div class="simple_likebuttons_container_small">
      <div class="simple_likebuttons_googleplus">
        <g:plusone size="medium" count="false" href="http://jakob.engbloms.se/archives/1159"></g:plusone>
      </div>
    
      <div class="simple_likebuttons_twitter simple_likebuttons_twitter_s">
        <a href="https://twitter.com/share" class="twitter-share-button" data-count="none" data-url="http://jakob.engbloms.se/archives/1159" data-lang="en">Tweet</a>
      </div>
    
      <div class="simple_likebuttons_facebook">
        <div id="fb-root"></div>
        <script>(function(d, s, id) {
          var js, fjs = d.getElementsByTagName(s)[0];
          if (d.getElementById(id)) {return;}
          js = d.createElement(s); js.id = id;
          js.src = "//connect.facebook.net/en_US/all.js#xfbml=1";
          fjs.parentNode.insertBefore(js, fjs);
        }(document, "script", "facebook-jssdk"));</script>
        <div class="fb-like" data-href="http://jakob.engbloms.se/archives/1159" data-send="false" data-layout="button_count" data-show-faces="false" data-width="90"></div>
      </div>
    </div>]]></content:encoded>
			<wfw:commentRss>http://jakob.engbloms.se/archives/1159/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>C in Danger &#8211; and thus Higher-Level Languages (?)</title>
		<link>http://jakob.engbloms.se/archives/1131?&#038;owa_medium=feed&#038;owa_sid=</link>
		<comments>http://jakob.engbloms.se/archives/1131#comments</comments>
		<pubDate>Sun, 09 May 2010 20:00:20 +0000</pubDate>
		<dc:creator>Jakob</dc:creator>
				<category><![CDATA[programming]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[Android]]></category>
		<category><![CDATA[C]]></category>
		<category><![CDATA[DSL]]></category>
		<category><![CDATA[Erlang]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[Nokia]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[Windows phone]]></category>

		<guid isPermaLink="false">http://jakob.engbloms.se/?p=1131</guid>
		<description><![CDATA[Some recent developments among development environments for mobile phones have made me consider the hereto unthinkable: that C might be on a decline as the universal programming language. Indeed, maybe there is even a chance that we will not have a universal low-level language in the future at all. What is happening is that the [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://jakob.engbloms.se/wp-content/uploads/2010/05/C-dino.png"><img class="alignleft size-full wp-image-1132" title="C dino" src="http://jakob.engbloms.se/wp-content/uploads/2010/05/C-dino.png" alt="" width="105" height="94" /></a>Some recent developments among development environments for mobile phones have made me consider the hereto unthinkable: that C might be on a decline as the universal programming language. Indeed, maybe there is even a chance that we will not have a universal low-level language in the future at all. What is happening is that the hitherto &#8220;given&#8221; role of C as the base language for a platform is being questioned. The reason appears to be security, which cannot be said to be a bad thing. However, a large-scale move away from C might hurt many of today&#8217;s higher-level languages and even model-based engineering.<br />
<span id="more-1131"></span><br />
So what is going on? For the past decade or two, and even longer back than that on Unix platforms, it has been a truth that a (well-written) C program can be made to run on any platform. All platforms have had C compilers available (even Windows), and C programs with a dash of platform-dependent code in file operations could be easily made portable.  This has been used by common cross-platform application programs like Firefox, the Gimp, MySQL, and Wireshark, as well as by technical products like MatLab, the Diab and IAR C compilers (which I once worked on), and Simics (which I currently work on). It is a way of creating software that in my experience works very well. Especially since pretty much anything higher-level can be made to link with a basic C code base.</p>
<p>Ever since Unix became the role model for operating systems, C has been the &#8220;base&#8221; language. In desktop operating systems like Windows and Linux the platform API is expressed as C function calls, and the ABI (the binary calling conventions) for linking code from different compilation units and binary distribution units is also expressed in terms of the code that a C compiler would generate. A C compiler is the first thing you need to get the platform going, and C is a language that allows arbitrary applications to be developed and run on the platform. The semantics of dynamically loadable and shared objects are expressed in C, not C++, as the C++ ABI is too variable.</p>
<p>This ubiquitousness of C has also proven to  be a key enabler for higher-level languages. C is the language of choice to implement the basic virtual machines used by languages and programming systems like Perl, Python, Erlang, and Java. C (or C++) is also used as the target language of many modeling tools with code generation, such as MatLab/Simulink, Rational Rose, Rhapsody, and Labview. A single generator of C code can be reused to target many platforms. Sometimes C++ is the generated language (in particular for UML-based object-oriented tools), but C++ essentially falls back on the ubiquitousness of C to be able to call platform APIs and connect to other tools.</p>
<p>That is the state of things as we know them today. What seems to be happening is that this is slowly being deprecated&#8230; platforms are coming out where user code might not be possible to write in C at all, or where C programs cannot access the real platform API. For these platforms, it is quite difficult  port in an existing C/C++ portable program.</p>
<p>The first example is Google&#8217;s mobile phone operating system Android,where  Java was the only supported language at launch. Google have since made it possible to use C and C++ for some parts of an application, <a href="http://arstechnica.com/open-source/news/2009/06/android-goes-beyond-java-gains-native-cc-dev-kit.ars ">but it does not seem to be a full platform API allowing a whole program to be written only in C or C++: </a></p>
<blockquote><p>&#8220;The NDK will not benefit most applications. As a developer, you will need to balance its benefits against its drawbacks; notably, using native code does not result in an automatic performance increase, but does always increase application complexity,&#8221; the documentation says. &#8220;Typical good candidates for the NDK are self-contained, CPU-intensive operations that don&#8217;t allocate much memory, such as signal processing, physics simulation, and so on.&#8221;</p></blockquote>
<p>To port an application written in C/C++ such as Firefox to the Android platform, the app has to be modified to work as a backend to the Java interface.  <a href="http://arstechnica.com/open-source/reviews/2010/02/hands-on-and-under-the-hood-ars-tests-firefox-on-android.ars  ">ArsTechnica has a write-up on how Firefox was brought to Android through just such a modification</a>. Note that this does mean that ports are not as straight-forward as they would be to other platforms with a directly accesible C API. Interestingly, the Android approach essentially inverts the traditional relationship between C and other languages, where it was common to have a C adapter layer around other languages (like Java) in order to access the platform.</p>
<p>Note that the NDK quote does not mention language run-times. One of my favorite languages, Python, has had to be completely reimplented to run on Android. <a href="http://stackoverflow.com/questions/101754/is-there-any-way-to-run-python-on-android">Either using a &#8220;Jython&#8221; approach of compiling Python to Java byte codes, or using the Android Scripting Environment</a>.</p>
<p>Other languages that you would ordinarily just port using a simple recompile of the its C code base are not helped by this at all. One interesting example is the <a href="http://erlang.2086793.n4.nabble.com/Running-Erlang-on-Android-td2107544.html#a2107544">Erlang runtime</a>, which is basis for CouchDB. According to an interview on <a href="http://twit.tv/floss99">FLOSS weekly show 99, about Ubuntu One</a>, this fact prevents Ubuntu One from synching data from your desktop to your phone.  This demonstrates that the assumption that you can run a C program on &#8220;any Unix-like system&#8221; is no longer true for a large numbers of smartphones&#8230; and that is already affecting how you have to develop products.</p>
<p>Microsoft is also moving in the &#8220;no C for you&#8221; direction with Windows Mobile 7, where C# is the default language. This also prevents easy reuse of existing C programs on smartphones. <a href="http://arstechnica.com/microsoft/news/2010/03/winphones-first-big-native-code-casualty-firefox-on-winmob.ars">Ars Technica notes how this killed Firefox on Microsoft-based mobiles</a>.</p>
<p>Finally, we have Apples downright weird approach to languages and programming. Their recent banning of <a href="http://arstechnica.com/apple/news/2010/04/apple-takes-aim-at-adobe-or-android.ars">anything except Objective C and their own compilers </a>for iPhones (and iPods and iPads) is downright bizarre. They explicitly forbid code-generating tools to be used with their platform, as well as kicking out any alternative language runtimes (which is a move aimed at Adobe Flash that also hits Erlang, Python, et al.). This might make some sense from a security perspective, as it prevents programs from loading executable code at run-time on the phone&#8230; but it also makes for a much more restricted set of programming tools.</p>
<p>The only mobile platform that seems honest to old traditions is really Nokia&#8217;s Maemo. And Symbian. Suddenly, what used to be considered &#8220;closed&#8221; platforms have become the most open and most desktop-like of all the mobile operating systems. Really, that is a very important reason to get a Nokia N900 rather than an Android or Apple device.</p>
<p>I think this points to a somewhat more complicated future, where mobile applications will cannot be cross-platform, as you have to use Android-Java, Windows-C#, iPhone-ObjC, and Maemo-C/C++/anything to code. It could also point to a move even in the desktop and server space away from C and to more sandboxed, controlled, and not-as-common programming platforms. That would be really bad from a programmer productivity and language innovation perspective, as so much of the innovations today are actually based on the ubiquitousness of C and the use of C as a good implementation language and code-generation target language.</p>
<h3>Updates and clarifications</h3>
<p>Given the comments below, it seems that I need to make some things clearer&#8230;</p>
<p>First, the iPhone. It is really a special case, in that you do have C/objective-C access to the API. So in principle, you could port any C program including language virtual machines to the iPhone. Firefox, for example, would work. However, Apple for commercial (and maybe security) reasons does not allow programs that implement virtual machines to be distributed across their controlled application store. That you can implement a VM there does not really help you, as it is the first openly programmable platform that I have seen where a control body actually forbids certain classes of programs. The Apple approach is apparently even more idiotic than I first believed.  According to some more reports I read and heard, they do not enforce a technical limitation on the final program (such as running in a JVM or .net VM), but rather require all software to be originally and directly written in C, C#, or C++.  All just a swipe at Adobe and flash&#8230; so even Flash compiled to native code is disallowed.  And with it goes all other higher-level languages.</p>
<p>Second, on security. I do think that running programs on top of a VM like done with Java and .net does have security benefits. It gives you a level of indirection which can be used to check what applications does. Obviously not perfect since there will always be bugs and mistakes, but still it is a better architecture than raw access to the underlying machine. The  iPhone controlled mode of distribution could also be beneficial here. The <a href="http://www.twit.tv/sn245">SecurityNow podcast episode 245 </a>discusses this topic.</p>
<p>Third, on appropriate programming languages for different tasks. I totally agree with some comments that C is not a very nice language for GUI programming. No doubt about that. However, that was not really the point I was trying to make. I want to use higher level languages! But not having C available might make that harder and with limited choice&#8230; leading up to point four.</p>
<p>Fourth, my core point. <strong>Having platform-level access in C is a basic technology used today to implement the higher-level environments</strong>. Languages like Python, Perl, Erlang, Lua, and even the basic Java and .net virtual machines, all depend on having C available to bootstrap the process of getting the core virtual machine going. If we take this away, we limit choice in language and might stifle innovation, as well as the attractiveness of cross-platform environments.</p>
<p>Fifth, I agree with the comments C is definitely not going anywhere in terms of being used to develop operating systems and embedded systems (that&#8217;s where I spend most of my time, by the way). My observation is about what is happening to user-level programming for certain systems, not the systems programming which is intentionally made separate from user-level programming.</p>
<p><strong>Another Update:</strong></p>
<p>The Inquirer just pointed out that <a href="http://www.theregister.co.uk/2010/06/11/steve_jobs_lifts_interpreted_code_ban_for_chosen_few/">Apple is explicitly forbidding interpreters </a>to run on their phones, unless it is an interpreter they created or one explicitly allowed. That&#8217;s making the above very clear, Apple is consciously denying iPhone users all modern programming languages. And that&#8217;s just to make sure Adobe can&#8217;t weasel Flash in there. Politics sometimes make no sense at all. The Inq quote is worth quoting:</p>
<blockquote><p><em>Famously, when Apple released its iPhone SDK in spring of 2008, the  end user licensing agreement barred applications from downloading and  running any interpreted code. &#8220;No interpreted code may be downloaded or  used in an Application except for code that is interpreted and run by  Apple’s Documented APIs and built-in interpreter(s),&#8221; it said.</em></p></blockquote>
<div class="simple_likebuttons_container_small">
      <div class="simple_likebuttons_googleplus">
        <g:plusone size="medium" count="false" href="http://jakob.engbloms.se/archives/1131"></g:plusone>
      </div>
    
      <div class="simple_likebuttons_twitter simple_likebuttons_twitter_s">
        <a href="https://twitter.com/share" class="twitter-share-button" data-count="none" data-url="http://jakob.engbloms.se/archives/1131" data-lang="en">Tweet</a>
      </div>
    
      <div class="simple_likebuttons_facebook">
        <div id="fb-root"></div>
        <script>(function(d, s, id) {
          var js, fjs = d.getElementsByTagName(s)[0];
          if (d.getElementById(id)) {return;}
          js = d.createElement(s); js.id = id;
          js.src = "//connect.facebook.net/en_US/all.js#xfbml=1";
          fjs.parentNode.insertBefore(js, fjs);
        }(document, "script", "facebook-jssdk"));</script>
        <div class="fb-like" data-href="http://jakob.engbloms.se/archives/1131" data-send="false" data-layout="button_count" data-show-faces="false" data-width="90"></div>
      </div>
    </div>]]></content:encoded>
			<wfw:commentRss>http://jakob.engbloms.se/archives/1131/feed</wfw:commentRss>
		<slash:comments>23</slash:comments>
		</item>
		<item>
		<title>Questioning the Choice of C++</title>
		<link>http://jakob.engbloms.se/archives/692?&#038;owa_medium=feed&#038;owa_sid=</link>
		<comments>http://jakob.engbloms.se/archives/692#comments</comments>
		<pubDate>Sat, 14 Mar 2009 20:37:01 +0000</pubDate>
		<dc:creator>Jakob</dc:creator>
				<category><![CDATA[desktop software]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[C/C++]]></category>
		<category><![CDATA[FLOSS Weekly]]></category>
		<category><![CDATA[Leo Laporte]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[Randall Schwartz]]></category>
		<category><![CDATA[xbmc]]></category>

		<guid isPermaLink="false">http://jakob.engbloms.se/?p=692</guid>
		<description><![CDATA[In FLOSS Weekly issue 57, about 20 minutes into the show, Randall Schwartz and Leo Laporte express genuine surprise that the XMBC media player application is all in C++. That is pretty telling, some parts of the computing world are indeed moving on to more modern pastures like Python, Perl, Ruby, and even Objective C [...]]]></description>
			<content:encoded><![CDATA[<p><img class="size-full wp-image-214 alignleft" style="margin: 5px;" title="flossweekly" src="http://jakob.engbloms.se/wp-content/uploads/2008/08/flossweekly.jpg" alt="flossweekly" width="70" height="70" />In <a href="http://www.twit.tv/floss57">FLOSS Weekly issue 57</a>, about 20 minutes into the show, Randall Schwartz and Leo Laporte express genuine surprise that the <a href="http://xbmc.org/">XMBC media player </a>application is all in C++. That is pretty telling, some parts of the computing world are indeed moving on to more modern pastures like Python, Perl, Ruby, and even Objective C (for the Mac people). And quite a contrast to the EDA world where C++ is still considered the new shiny thing, as I <a href="http://jakob.engbloms.se/archives/165"></a><a href="http://jakob.engbloms.se/archives/242">have </a>lamented <a href="http://jakob.engbloms.se/archives/186">before</a>&#8230; thanks for that small but golden genuine surprise, Randall and Leo!</p>
<p><span id="more-692"></span>But note that the application IS written in C++ still: that is the only choice on the xbox where the project started, by design by Microsoft. However, you can use my favorite scripting language Python to script and skin the application.</p>
<div class="simple_likebuttons_container_small">
      <div class="simple_likebuttons_googleplus">
        <g:plusone size="medium" count="false" href="http://jakob.engbloms.se/archives/692"></g:plusone>
      </div>
    
      <div class="simple_likebuttons_twitter simple_likebuttons_twitter_s">
        <a href="https://twitter.com/share" class="twitter-share-button" data-count="none" data-url="http://jakob.engbloms.se/archives/692" data-lang="en">Tweet</a>
      </div>
    
      <div class="simple_likebuttons_facebook">
        <div id="fb-root"></div>
        <script>(function(d, s, id) {
          var js, fjs = d.getElementsByTagName(s)[0];
          if (d.getElementById(id)) {return;}
          js = d.createElement(s); js.id = id;
          js.src = "//connect.facebook.net/en_US/all.js#xfbml=1";
          fjs.parentNode.insertBefore(js, fjs);
        }(document, "script", "facebook-jssdk"));</script>
        <div class="fb-like" data-href="http://jakob.engbloms.se/archives/692" data-send="false" data-layout="button_count" data-show-faces="false" data-width="90"></div>
      </div>
    </div>]]></content:encoded>
			<wfw:commentRss>http://jakob.engbloms.se/archives/692/feed</wfw:commentRss>
		<slash:comments>15</slash:comments>
		</item>
		<item>
		<title>In Praise of Scripting: Something for Modeling as Well?</title>
		<link>http://jakob.engbloms.se/archives/186?&#038;owa_medium=feed&#038;owa_sid=</link>
		<comments>http://jakob.engbloms.se/archives/186#comments</comments>
		<pubDate>Sun, 03 Aug 2008 20:40:51 +0000</pubDate>
		<dc:creator>Jakob</dc:creator>
				<category><![CDATA[computer simulation technology]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[virtual platforms]]></category>
		<category><![CDATA[C/C++]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[DML]]></category>
		<category><![CDATA[Domain-specific languages]]></category>
		<category><![CDATA[programming languages]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[scripting languages]]></category>
		<category><![CDATA[simulation]]></category>
		<category><![CDATA[software tools]]></category>

		<guid isPermaLink="false">http://jakob.engbloms.se/?p=186</guid>
		<description><![CDATA[In the July 2008 issue of IEEE Computer, there is short article called &#8220;In Praise of Scripting: Real Programming Pragmatism&#8220;, by Ronald P. Loui, a professor at Washington University (WUSTL). The article deals with the issue of what is the appropriate first language to teach new CS (Computer Science) students, and considers that a &#8220;scripting&#8221; [...]]]></description>
			<content:encoded><![CDATA[<p><img class="size-medium wp-image-187 alignleft" style="margin: 5px 10px;" title="ieee-computer" src="http://jakob.engbloms.se/wp-content/uploads/2008/08/ieee-computer.gif" alt="" width="89" height="71" />In the <a href="http://www.computer.org">July 2008 issue of IEEE Computer</a>, there is short article called &#8220;<a href="http://doi.ieeecomputersociety.org/10.1109/MC.2008.228">In Praise of Scripting: Real Programming Pragmatism</a>&#8220;, by <a href="http://www.cs.wustl.edu/~loui/">Ronald P. Loui, a professor at Washington University</a> (WUSTL). The article deals with the issue of what is the appropriate first language to teach new CS (Computer Science) students, and considers that a &#8220;scripting&#8221; langauge like Python or Ruby might be way better than Java (no doubt about that I think).</p>
<p>The interesting material in the article is the background on WHY he thinks that this is the case. He points to the immense popularity and rise of scripting in much of computing land. In the past ten years, it is clear to him (and I would agree with this too mostly) that languages like Perl, PHP, Awk, Ruby, JavaScript, and Python have eclipse Java and C++ as the most interesting and important programming languages for many practical tasks. Especially for web applications, where Java seems to have a presence but noone would dream of using something as clunky and impractical as C.</p>
<p>What can this teach us for the purpose of simulation and the creation of models of computer system hardware for the purpose of simulation? Maybe a fair bit&#8230;</p>
<p><span id="more-186"></span></p>
<p>The reason that scripting languages have gotten so popular is primarily that they let you get the job done faster. In web land, this is due to a few important factors listed or hinted at in the article:</p>
<ul>
<li>The overall code tends to be shorter and more to the point</li>
<li>A tendency to make any value into a string when needed (excellent debugging aid)</li>
<li>Dynamic typing, variables that just appear when needed</li>
<li>Automatic memory management</li>
<li>Ease of handling strings</li>
<li>Most tasks are pretty short</li>
<li>Performance of computation does not matter very much when processors are as fast as they are today and a single disk or network access operations is likely to dominate programming time</li>
</ul>
<p>What the article continues with a discussion that we need to focus on programming language <em>pragmatics</em> rather than syntax or semantics. How <em>practical </em>is the language for the everyday tasks of a programmer? And it seems that simple darwinian evolution has propelled scripting-style languages to the top of heap here. Purity and elegance and deep semantical properties are obviously less important than getting the job done in the shortest time possible.</p>
<p>What can this teach us modeling folks?</p>
<ul>
<li>A key takeaway is the focus on short code. Code has to be short and focused to be quick and easy to write. You should not need to consult several header files and lots of documentation to understand and formulate your code, which is an ill that keeps hitting C and C++ programs.</li>
<li>Memory management has nothing to do in a productive programming environment.</li>
<li>Basic types have to be appropriate to the task at hand.</li>
<li>Syntax has to be concise and powerful.</li>
<li>Dynamic typing is much faster to code with than static typing and variable declarations.</li>
<li>An interactive &#8220;try it out&#8221; environment is preferable to long compile/link/test cycles.</li>
</ul>
<p>Obviously, some of these do not translate well into hardware modeling. Hardware entities tend to have very-well-defined types by nature. If I have a 16-bit register containing a 13-bit counter and three status bits, I cannot very well let that counter be a dynamic variable that can take on any numeric value. Or the atom &#8220;foo&#8221;. It kind of has to be restricted in semantics to how the hardware would behave&#8230; it is not just a &#8220;value&#8221; to be manipulated quite abstractly. Which means that what you probably rather need are types well-suited for the task at hand.</p>
<p>It is also nice if variables can just pop into existence when needed, with the least amount of declaration possible. Another C-family performance killer is the annoying need to declare a function before calling it. That made sense in linearly scanning compilers back in the 1970s, but today, just let the compiler take the entire program into account and find the function. It is not that hard, especially not for the quite small and isolated context that a virtual platform device model is (few device models are more than a few thousand lines of code in my experience).</p>
<p>The interactive nature of scripting is also interesting. The ability to just write new code directly into a running system without an explicit compile usually rests on a virtual-machine approach and does have some cost in terms of performance. And unlike webservers, virtual platforms need all the raw CPU performance they can get! However, it make excellent sense to use an interactive environment to prototype and test things, and then move the resulting code to a harder compile stage.</p>
<p>Right now, we really do not have such a tool at hand. <a href="http://www.virtutech.com/whitepapers/virtutech_dml.html">Virtutech DML </a>is <a href="http://www.scdsource.com/article.php?id=166">in my opinion </a>the most promising step along this road, but it is not really &#8220;perl for modeling&#8221; at this time. SystemC has too many C++ roots to really behave well in this respect&#8230; you get all the drawbacks of explicit memory management, rampant headerfiles, and statically declared types. It might be good to compile, but it sure is an absolute pain to write.</p>
<p>And if we want virtual platforms to really fly, it is not so much &#8220;all about the models&#8221;, but really &#8220;all about model programming&#8221; &#8212; since there is a huge volume of models that need to written out there, and getting the time needed to write these models down is a primary concern. The total work invested in modeling any particular device is what we need to focus on, really.</p>
<div class="simple_likebuttons_container_small">
      <div class="simple_likebuttons_googleplus">
        <g:plusone size="medium" count="false" href="http://jakob.engbloms.se/archives/186"></g:plusone>
      </div>
    
      <div class="simple_likebuttons_twitter simple_likebuttons_twitter_s">
        <a href="https://twitter.com/share" class="twitter-share-button" data-count="none" data-url="http://jakob.engbloms.se/archives/186" data-lang="en">Tweet</a>
      </div>
    
      <div class="simple_likebuttons_facebook">
        <div id="fb-root"></div>
        <script>(function(d, s, id) {
          var js, fjs = d.getElementsByTagName(s)[0];
          if (d.getElementById(id)) {return;}
          js = d.createElement(s); js.id = id;
          js.src = "//connect.facebook.net/en_US/all.js#xfbml=1";
          fjs.parentNode.insertBefore(js, fjs);
        }(document, "script", "facebook-jssdk"));</script>
        <div class="fb-like" data-href="http://jakob.engbloms.se/archives/186" data-send="false" data-layout="button_count" data-show-faces="false" data-width="90"></div>
      </div>
    </div>]]></content:encoded>
			<wfw:commentRss>http://jakob.engbloms.se/archives/186/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

