the blog
Back to -Blog

Semantic error detection in Amethyst 2

Locate problems before they happen
by Dermot Hogan
Wednesday 2 January 2013.

Typically, there are two classes of errors in code. The first are ’syntax’ errors, such as leaving a ’{’ out. These are easily detected and fixed. But the second type – ’semantic’ errors’ – where the syntax is correct but the meaning is nonsensical or incorrect can be a good bit harder to spot. We’ve added a number of semantic error checks in the forthcoming version 2 of our Amethyst IDE.

The classic example in C like languages of a semantic errors is the statement

if (x = 2) y = 5;

What is usually meant is

if (x == 2) y = 5;

This peculiar use of ‘=’ and ‘==’ goes right back to the earliest days of C and I think this must be responsible for more accidental errors than any other language construct in existence. Apparently, Ken Thompson (one of the authors of C) was a firm believer in minimising any typing. C was derived from a previous language, BCPL, via an intermediate language, B (and you can already see Thompson’s desire to eliminate any ’excess’ characters in the name of the language!). Thompson reckoned that = being one character shorter than the BCPL assignment operator := was much superior and used that (see Anyway, semantic error checking detects errors in meaning such as this example and flags them using, in Amethyst’s case, green ‘squigglies’.

You can turn on semantic error checking via an editor option:

We’ve included six semantic error checks:

1) Not all code paths return a value

2) A variable having the same name as a parameter

3) A variable being declared but not used

4) Use of an unassigned local variable

5) Assignment in test (that is, the example above)

6) Unreachable code

We’ve also implemented ’coercion’ checks – assigning a Boolean to an integer, for example. However, using Booleans and integers seems to be relatively common in the ActionScript code that I’ve come across. It’s pretty poor programming practise in my view. If you can to do something like that, use a cast to make it explicit. You can see this in the ’assignment in test’ example above where the expression

a =1

yields an integer, but strictly speaking, an ‘if’ expression requires a Boolean value.

This is a preview of the forthcoming version of Amethyst 2 – our ActionScript/Flash IDE for Visual Studio 2012 and 2010. If you buy Amethyst 1.0 for Visual Studio 2010 now you will be entitled to a free update to Amethyst 2 when it is released. See the Amethyst 2012 announcement for more information.

Bookmark and Share   Keywords:  Amethyst 2  development
© SapphireSteel Software 2014
buy testosterone undecanoate 40mg bimatoprost buy fluticasone buy levitra rapacan sirolimus super kamagra 100mg + 60mg buy piracetam 800mg poxet 60mg buy lithosun sr online order piracetam order caberlin buy vega baclofen 25mg mestilon for sale ketasma snovitra rogaine shampoo for sale esomeprazole for sale buy zocor buy prosteride buy urimax 0.4mg order tadacip buy sildigra xl plus 150mg buy ranitidine online erlotinib 150mg apcalis jelly tadalafil jelly attentrol 10mg order sildenafil citrate buy eriacta 100mg rifagut for sale buy prednisolone buy fincar online buy lasix buy quinine sulphate 300mg malegra fxt buy bimatoprost opthalmic drops 0.03% buy malegra buy generic avanafil buy aldactone 25 mg azithromycin for sale buy namenda 10mg buy testosterone undecanoate buy qutipin online amlodac buy ciplactin online zhewitra for sale buy femalegra online phenytoin sodium 100mg orlistat xenical buy nodict online quetiapine 400mg armodafinil 150mg buspin for sale buy tadora online tizan buy tadaga online tadasoft tadalafil buy fluconazole online cotrim buy budeprion rapamune 1mg buy caverta 100mg pelosta for sale buy melanocyl modafresh modafinil ciprofloxacin cipro buy nizonide 500mg buy tadalafil order malegra dxt buy arpizol 5mg order premarin iressa 250mg buy memantine buy generic viagra 100mg buy armodafinil online megalis for sale buy generic ampicillin buy mirtaz online buy tretinoin sildisoft tadalafil 20mg amlodipine besylate for sale modvigil 200mg entecavir buy sildenafil citrate online buy enalapril maleate online buy imatib online order terbicip buy amitriptyline online viagra buy generic viraday buy viread 300mg clomiphene 100mg buy generic natamet buy baclofen online buy topirol online atorvastatin exemestane finpecia 1mg buy sorafenib online penegra for sale buy generic aurogra buy anabrez online buy testosterone undecanoate 40mg buy letrozole 2.5mg buy generic sustanon sildenafil citrate jelly 100mg suhagra tenofovir + emtricitabine 300 + 200mg buy prilosec duprost buy generic kamagra oral jelly buy lenalidomide buy testosterone gel buy flagyl 400mg buy super p force 100mg + 60mg flonida 5% rasagiline mesylate buy modalert buy generic doxicip buy calutide buy cutivate cream online buy sildenafil citrate online olanzapine buy garlic himalaya online order isotretinion biduret amiloride buy levetiracetam 750mg fluka buy clomiphene online buy generic floricot buy tadarise pro buy hostacycline online buy rizact buy valif 20mg arcalion sulbutiamine for sale armodafinil 150mg buy generic acamprol buy avanafil online vilitra for sale buy generic calaptin buy armodafinil 150mg buy bortenat 2mg buy doryx buy sildenafil citrate irovel 150mg order malegra professional avana 100mg buy pletoz voltaren 50mg buy tadalafil 20mg gleevec 100mg buy veenat online buy generic sulpitac naltroxene 50mg buy cialis super active 20mg buy auvitra online sildigra buproprion forzest tadalafil tadarise for sale metronidazole 200mg