Search Results

Search found 99 results on 4 pages for 'syntactic'.

Page 3/4 | < Previous Page | 1 2 3 4  | Next Page >

  • Why is there no IronPerl (Perl for .Net)?

    - by Renaud Bompuis
    I'm a bit disappointed that there doesn't seem to be any effort to make Perl a first-class citizen of the .Net world. I've read a few 'reasons' in the past but I don't see why they can't be overcome (different garbage collectors, hard-to-parse syntax, part of CPAN modules couldn't be ported, different communities, ...). Activestate has a Perl.Net product but it's a hack (in the good sense) around a standard interpreter and some syntactic sugar to interoperate with .Net assemblies. A few years ago they stopped they visual studio integration of Perl citing lack of interest. That was a while ago, before all the changes to .Net to make it more 'dynamic'. Am I the only one who yearns for IronPerl?

    Read the article

  • Can't set breakpoints on an auto-property setter ? Why?

    - by Cristi Diaconescu
    Apparently VS 2008 does not allow setting a breakpoint just on the setter of an auto-property. I.e. if I define an auto-property like this: public int CurrentFramesize { get; protected set; } and then try to set a breakpoint on the setter line, the whole auto-property turns breakpoint-red. This works just fine for normal properties, so any idea why auto-properties get this special (restrictive) treatment? Are they more than just syntactic sugar to normal properties with a hidden backing field?

    Read the article

  • Loopless function calls on vector/matrix members in Matlab/Octave

    - by Sint
    I came into matrix world from loop world(C, etc) I would like to call a function on each individual member of a vector/matrix, and return the resulting vector/matrix. This is how I currently do it: function retval = gauss(v, a, b, c) for i = 1:length(v) retval(i) = a*(e^(-(v(i)-b)*(v(i)-b)/(2*c*c))); endfor endfunction Example usage: octave:47> d=[1:1000]; octave:48> mycurve=gauss(d, 1, 500, 100); Now, all advice on Matlab/Octave says: STOP whenever you catch yourself using loops and think of a better way of doing it. Thus, my question: Can one call a function on each member of a vector/matrix and return the result in a new vector/matrix all at once without using explicit loops? That is I am looking for something like this: function retval = newfun(v) retval = 42*(v^23); endfunction Perhaps, it is just syntactic sugar, that is all, but still would be useful to know.

    Read the article

  • Resources to learn sh scripting 'just like a normal programming language'

    - by Homer J. Simpson
    Hi, what is the best resource (book would be nice) to learn sh scripting (the "standard" shell on Unix systems) just like when i would learn a "normal" programming/scripting language ? There are lots of tutorials on certain aspects of shell scripting, they mostly deal with shells in general and unix commands and so on, but i would rather like to find a more general approach - meaning a quick syntactic overview and an outlook on how to do things you normally do when programming, like implementing small algorithms and so on. Doing actual scripting, not just a structured batch file. And rather 100-liners than 1-to-3-liners. Can you recommend a good standard book on the topic ?

    Read the article

  • How do I get Nant to use the 4.0 compiler to target .Net 3.5

    - by Rory Becker
    Yes I know that sounds a little bit crazy, but I've got .Net 3.5 deployed in the field and I'd like to use the new 4.0 compiler to target it. There are several new syntactic sugar features in the latest versions of Vb.Net and C# which I would like to use,but I am unable (just yet) to enforce a new version of the .Net framework and CLR on my client base. Before the nay sayers jump in with both feet... I have just successfully used Studio 2010 to compile a 3.5 targeted app which used VB.Net auto properties (A new feature in VB.Net 10) so I know the compilers are capable somehow. So back to my question.... How do I convince Nant to use the 4.0 compiler, but to target .Net 3.5 (CLR 2.0) Update: I am using the csc and vbc tasks and not the Solution task. although I'd settle for an answer on how to do this direct with the compilers at this point.

    Read the article

  • Purpose of dereferencing a pointer as a parameter in C.

    - by Leif Andersen
    I recently came along this line of code: CustomData_em_free_block(&em->vdata, &eve->data); And I thought, isn't: a->b just syntactic sugar for: (*a).b With that in mind, this line could be re-written as: CustomData_em_free_block(&(*em).vdata, &(*eve).data); If that's the case, what is the point of passing in &(*a), as a parameter, and not just a? It seems like the pointer equivalent of -(-a) is being passed in in, is there any logic for this? Thank you.

    Read the article

  • http(/* argument here */) How is this Object (Http) being used without an explicit or implicit meth

    - by Randin
    In the example for coding with Json using Databinder Dispatch Nathan uses an Object (Http) without a method, shown here: import dispatch._ import Http._ Http("http://www.fox.com/dollhouse/" >>> System.out ) How is he doing this? Thank you for all of the answers unfortunatly I was not specific enough... It looks like it is simply passing an argument to a constructor of class or companion object Http. In another example, I've seen another form: http = new Http http(/* argument here */) Is this valid Scala? I guess it must be, because the author is a Scala expert. But it makes no sense to me. Actions are usually performed by invoking methods on objects, whether explicitly as object.doSomething() or implicitly as object = something (using the apply() method underneath the syntactic sugar). All I can think of is that a constructor is being used to do something in addition to constructing an object. In other words, it is having side effects, such as in this case going off and doing something on the web.

    Read the article

  • How to make Spring accept fluent (non-void) setters?

    - by Chris
    Hi, I have an API which I am turning into an internal DSL. As such, most methods in my PoJos return a reference to this so that I can chain methods together declaratively as such (syntactic sugar). myComponent .setID("MyId") .setProperty("One") .setProperty2("Two") .setAssociation(anotherComponent) .execute(); My API does not depend on Spring but I wish to make it 'Spring-Friendly' by being PoJo friendly with zero argument constructors, getters and setters. The problem is that Spring seems to not detect my setter methods when I have a non-void return type. The return type of this is very convenient when chaining together my commands so I don't want to destroy my programmatic API just be to compatible with Spring injection. Is there a setting in Spring to allow me to use non-void setters? Chris

    Read the article

  • How to make Spring accept non-void setters?

    - by Chris
    Hi, I have an API which I am turning into an internal DSL. As such, most methods in my PoJos return a reference to this so that I can chain methods together declaratively as such (syntactic sugar). myComponent .setID("MyId") .setProperty("One","1") .setProperty("Two","2") .setAssociation(anotherComponent) .execute(); My API does not depend on Spring but I wish to make it 'Spring-Friendly' by being PoJo friendly with zero argument constructors, getters and setters. The problem is that Spring seems to not detect my setter methods when I have a non-void return type. The return type of this is very convenient when chaining together my commands so I don't want to destroy my programmatic API just be to compatible with Spring injection. Is there a setting in Spring to allow me to use non-void setters? Chris

    Read the article

  • Graphical Programming Language

    - by prosseek
    In control engineering or instrumentation, I see Simulink or LabVIEW(G) is pretty popular. In ESL design, I see that Agilent SystemVue is gaining some popularity. If you see the well established compiler theroy, almost 100% is about the textual language. But how about the graphical language? Is there any noticable research or discussion about the graphical programming language? In terms of Theory about Graphical Language - syntactic/semantic analysis and whatever relevant expressiveness (Actually, I asked a question about it at SO - http://stackoverflow.com/questions/2427496/what-do-you-mean-by-the-expressiveness-in-programming-lanuguage) Possibility of the Graphical language ... Or what do you think about the Graphical Programming Language?

    Read the article

  • Java: why can't iterate over an iterator?

    - by noamtm
    I read http://stackoverflow.com/questions/839178/why-is-javas-iterator-not-an-iterable and http://stackoverflow.com/questions/27240/why-arent-enumerations-iterable, but I still don't understand why this: void foo(Iterator<X> it) { for (X x : it) { bar(x); baz(x); } } was not made possible. In other words, unless I'm missing something, the above could have been nice and valid syntactic sugar for: void foo(Iterator<X> it) { for (X x; it.hasNext();) { x = it.next(); bar(x); baz(x); } }

    Read the article

  • Spring MVC 3.0: Avoiding explicit JAXBElement<> wrapper in method arg

    - by Keith Myers
    I have the following method and want to avoid having to explicitly show the JAXBElement< syntax. Is there some sort of annotation that would allow the method to appear to accept raw MessageResponse objects but in actuality work the same as shown below? I'm not sure how clear that was so I'll say this: I'm looking for some syntactic sugar :) @ServiceActivator public void handleMessageResponse(JAXBElement<MessageResponse> jaxbResponse) { MessageResponse response = jaxbResponse.getValue(); MessageStatus status = messageStatusDao.getByStoreIdAndMessageId(response.getStoreId(), response.getMessageId()); status.setStatusTimestamp(response.getDate()); status.setStatus("Complete"); }

    Read the article

  • I need help translating this portion of the ECMAScript grammar?

    - by ChaosPandion
    I've been working on my own implementation of ECMAScript for quite some time now. I have basically done everything by hand to help gain a deep understanding of the process. Repeated attempts to analyze and understand this portion of the grammar have failed so I've been working on the run time instead. Now I am at a point were I will be working on object literals so I really need to polish my syntactic analyzer. Can anyone put this in terms a language parser novice could understand? My biggest source of confusion is the following: new MemberExpression Arguments This is supposed to be a member expression, but this seemingly conflicts with the following: NewExpression : MemberExpression new NewExpression Is a new expression a member expression or a left hand side expression? To be honest I am having trouble laying out the proper C# classes for the concrete grammar. MemberExpression : PrimaryExpression FunctionExpression MemberExpression [ Expression ] MemberExpression . IdentifierName new MemberExpression Arguments NewExpression : MemberExpression new NewExpression CallExpression : MemberExpression Arguments CallExpression Arguments CallExpression [ Expression ] CallExpression . IdentifierName LeftHandSideExpression : NewExpression CallExpression

    Read the article

  • Do I still have to implement a singleton class by hand in .net, even when using .Net4.0?

    - by Hamish Grubijan
    Once the singleton pattern is understood, writing subsequent singleton classes in C# is a brainless exercise. I would hope that the framework would help you by providing an interface or a base class to do that. Here is how I envision it: public sealed class Schablone : ISingleton<Schablone> { // Stuff forced by the interface goes here // Extra logic goes here } Does what I am looking for exist? Is there some syntactic sugar for constructing a singleton class - whether with an interface, a class attribute, etc.? Can one write a useful and bullet-proof ISingleton themselves? Care to try? Thanks!

    Read the article

  • How to sum up an array of integers in C#

    - by Filburt
    Is there a better shorter way than iterating over the array? int[] arr = new int[] { 1, 2, 3 }; int sum = 0; for (int i = 0; i < arr.Length; i++) { sum += arr[i]; } clarification: Better primary means cleaner code but hints on performance improvement are also welcome. (Like already mentioned: splitting large arrays). It's not like I was looking for killer performance improvement - I just wondered if this very kind of syntactic sugar wasn't already available: "There's String.Join - what the heck about int[]?".

    Read the article

  • Real thing about "->" and "."

    - by fsdfa
    I always wanted to know what is the real thing difference of how the compiler see a pointer to a struct (in C suppose) and a struct itself. struct person p; struct person *pp; pp->age, I always imagine that the compiler does: "value of pp + offset of atribute "age" in the struct". But what it does with person.p? It would be almost the same. For me "the programmer", p is not a memory address, its like "the structure itself", but of course this is not how the compiler deal with it. My guess is it's more of a syntactic thing, and the compiler always does (&p)->age. I'm correct?

    Read the article

  • Exception handling in Iterable

    - by Maas
    Is there any way of handling -- and continuing from -- an exception in an iterator while maintaining the foreach syntactic sugar? I've got a parser that iterates over lines in a file, handing back a class-per-line. Occasionally lines will be syntactically bogus, but that doesn't necessarily mean that we shouldn't keep reading the file. My parser implements Iterable, but dealing with the potential exceptions means writing for (Iterator iter = myParser.iterator(); iter.hasNext(); ) { try { MyClass myClass = iter.next(); // .. do stuff .. } catch (Exception e) { // .. do exception stuff .. } } .. nothing wrong with that, but is there any way of getting exception handling on the implicit individual iter.next() calls in the foreach construct?

    Read the article

  • Enums With Default Throw Clause?

    - by Tom Tresansky
    I noticed the following in the Java Language spec in the section on enumerations here: link switch(this) { case PLUS: return x + y; case MINUS: return x - y; case TIMES: return x * y; case DIVIDE: return x / y; } throw new AssertionError("Unknown op: " + this); However, looking at the switch statement definition section, I didn't notice this particular syntax (the associated throw statement) anywhere. Can I use this sort of "default case is throw an exception" syntactic sugar outside of enum definitions? Does it have any special name? Is this considered a good/bad practice for short-cutting this behavior of "anything not in the list throws an exception"?

    Read the article

  • Benefits of arrays

    - by Vitalii Fedorenko
    As I see it, the advantages of List over array are pretty obvious: Generics provide more precise typing: List<Integer>, List<? extends Number>, List<? super Integer>. List interface has a bunch useful methods: addAll, remove etc. While for arrays all standard operations except get/set must be performed in a procedure manner by passing it to a static method. Collections offer different implementations like ArrayList, LinkedList, unmodifieable and synchronized lists, which can be hidden under common List interface. OOB length control. As disadvantages I can only mention absence of syntactic sugar and runtime type check. At the same time supporting of both structures requires frequent using of asList and toArray methods, which makes code less readable. So I am curious if there are any important benefits of using arrays that I miss.

    Read the article

  • What is the smallest amount of bits you can write twin-prime calculation?

    - by HH
    A succinct example in Python, its source. Explanation about the syntactic sugar here. s=p=1;exec"if s%p*s%~-~p:print`p`+','+`p+2`\ns*=p*p;p+=2\n"*999 The smallest amount of bits is defined by the smallest amount of 4pcs of things you can see with hexdump, it is not that precise measure but well-enough until an ambiguity. $ echo 's=p=1;exec"if s%p*s%~-~p:print`p`+','+`p+2`\ns*=p*p;p+=2\n"*999' > .test $ hexdump .test | wc 5 36 200 $ hexdump .test 0000000 3d73 3d70 3b31 7865 6365 6922 2066 2573 0000010 2a70 2573 2d7e 707e 703a 6972 746e 7060 0000020 2b60 2b2c 7060 322b 5c60 736e 3d2a 2a70 0000030 3b70 2b70 323d 6e5c 2a22 3939 0a39 000003e so in this case it is 31 because the initial parts are removed.

    Read the article

  • Why did the C# designers attach three different meanings to the 'using' keyword?

    - by gWiz
    The using keyword has three disparate meanings: type/namespace aliasing namespace import syntactic sugar for ensuring Dispose is called The documentation calls the first two definitions directives (which I'm guessing means they are preprocessing in nature), while the last is a statement. Regardless of the fact that they are distinguished by their syntaxes, why would the language developers complicate the semantics of the keyword by attaching three different meanings to it? For example, (disclaimer: off the top of my head, there may certainly be better examples) why not add keywords like alias and import? Technical, theoretical, or historical reasons? Keyword quota? ;-) Contrived sample: import System.Timers; alias LiteTimer=System.Threading.Timer; alias WinForms=System.Windows.Forms; public class Sample { public void Action { var elapsed = false; using(var t = new LiteTimer.Timer(_ => elapsed = true) { while (!elapsed) CallSomeFinickyApi(); } } } "Using" is such a vague word.

    Read the article

  • When iterating over values, why does typeof(value) return "string" when value is a number? Javascrip

    - by Mark
    I'm using Google Chrome for this test: Contrary to intuition, the first loop alerts "string" 3 times, while the second loop alerts "number" 3 times. numarray = [1, 2, 3]; //for-each loop for(num in numarray) alert(typeof(num)); //standard loop for(i=0; i<numarray.length; i++) alert(typeof(numarray[i])); I was expecting both loops to alert "number" 3 times. How is the first loop implemented in Javascript? In other words, if the for-each is syntactic sugar, what is its equivalent using a standard loop? Also, is there some way to iterate over an object's namespace using a standard loop? I'm looking to touch every one of some object's methods and attributes using a loop of the second kind. I'm new to Javascript and any help is highly appreciated, thanks.

    Read the article

  • Why can't Java/C# implement RAII?

    - by mike30
    Question: Why can't Java/C# implement RAII? Clarification: I am aware the garbage collector is not deterministic. So with the current language features it is not possible for an object's Dispose() method to be called automatically on scope exit. But could such a deterministic feature be added? My understanding: I feel an implementation of RAII must satisfy two requirements: 1. The lifetime of a resource must be bound to a scope. 2. Implicit. The freeing of the resource must happen without an explicit statement by the programmer. Analogous to a garbage collector freeing memory without an explicit statement. The "implicitness" only needs to occur at point of use of the class. The class library creator must of course explicitly implement a destructor or Dispose() method. Java/C# satisfy point 1. In C# a resource implementing IDisposable can be bound to a "using" scope: void test() { using(Resource r = new Resource()) { r.foo(); }//resource released on scope exit } This does not satisfy point 2. The programmer must explicitly tie the object to a special "using" scope. Programmers can (and do) forget to explicitly tie the resource to a scope, creating a leak. In fact the "using" blocks are converted to try-finally-dispose() code by the compiler. It has the same explicit nature of the try-finally-dispose() pattern. Without an implicit release, the hook to a scope is syntactic sugar. void test() { //Programmer forgot (or was not aware of the need) to explicitly //bind Resource to a scope. Resource r = new Resource(); r.foo(); }//resource leaked!!! I think it is worth creating a language feature in Java/C# allowing special objects that are hooked to the stack via a smart-pointer. The feature would allow you to flag a class as scope-bound, so that it always is created with a hook to the stack. There could be a options for different for different types of smart pointers. class Resource - ScopeBound { /* class details */ void Dispose() { //free resource } } void test() { //class Resource was flagged as ScopeBound so the tie to the stack is implicit. Resource r = new Resource(); //r is a smart-pointer r.foo(); }//resource released on scope exit. I think implicitness is "worth it". Just as the implicitness of garbage collection is "worth it". Explicit using blocks are refreshing on the eyes, but offer no semantic advantage over try-finally-dispose(). Is it impractical to implement such a feature into the Java/C# languages? Could it be introduced without breaking old code?

    Read the article

  • New JavaScript Editor

    - by Petr
    I did not write a blog post here for a few weeks. I think the last my post was  about releasing NetBeans 7.1 in the beginning of January. The reason is not that I would change the job:), but that I have concentrated on new JavaScript support/editor. The new JavaScript editor is written basically from scratch. The answer for the question "Why from beginning again, why do you just improve the old one?" is not easy and the decision has more aspects. One of the main reasons is that the old support was written 4 years ago and the architecture is limited. Also during the time, the APIs were changed and it was very hard to keep the editor up to date. Also there is a license issue etc. In short, it is time to rewrite the old JS editor.  We build up strong community about the PHP support in NetBeans and because many PHP developers also write JavaScript code I would like to ask you for a help. There is a continual PHP build with the new JavaScript support. You can download the result of the builds here. It's a zip file. You can unzip the file anywhere, where you want. I recommend to run the build with the new userdir, to avoid damaging your current userdir. It shouldn't happened, but just to be sure:). You can achieve this through the switch --userdir. So start the unzipped file from command line from the folder, where you unzipped it, can be done with this command on unix: bin/netbeans.sh --userdir /path/to/new/userdir and on windows: bin\netbeans.exe --userdir D:\path\to\new\userdir For the developers who use continual php build already, it's well known. There is also full IDE build with the new JavaScript support for people, who need more than only PHP support.  Because the builds with the new JavaScript editor is created from a branch, there are not nightly builds available. They will be, when we merge the branch to the trunk, but so far we have to work only with the mentioned continual build. We will merge our branch after branching NetBeans 7.2 from trunk. This is also answer for the question, what release of NetBeans will contain the new JS support. It should be the release after NetBeans 7.2. I'm asking you whether you could play with the builds or better, could work in the builds with new JavaScript support and tell us every issue that you run in. It can be everything what doesn't fit you, something doesn't work as you expected, something is slow, you want change the behaviour of a feature etc. Your input / comments are very important for us and it will help us to achieve the new JavaScript support that you need.  The best way how to communicate issues is through our Bugzilla, because it is simple to track them. Sure you can write comment here:), but still I prefer Bugzilla for any issue. You can click here (you should be already log in Bugzilla), a form for the new JavaScript issue is opened, with pre-filled component Editor and NO72 keyword. I will write about the single features later, but now I will mentioned a few features that should work in better way than in the old support.  Syntactic and semantic colouring Navigator Mark Occurrences and GoTo Declaration  Code Completion Code Completion is invoked through keyboard shortcut CTRL+SPACE. The first invocation offers items that are found through a source model. Almost all editor features are based on the model, that is build from source code. There is a lot of work on the model yet, but it should offer better results. When the pop up window with code completion items is open and you press CTRL+SPACE again, then the code completion offers all elements that are in the project. In the pictures all elements that starts with letter 't'. Formatter with many options and more :) A few features are not still implemented that are supported in the old JavaScript support (for example jQuery support), but we are adding this features ASAP.

    Read the article

  • F# Objects &ndash; Integration with the other .Net Languages &ndash; Part 2

    - by MarkPearl
    So in part one of my posting I covered the real basics of object creation. Today I will hopefully dig a little deeper… My expert F# book brings up an interesting point – properties in F# are just syntactic sugar for method calls. This makes sense… for instance assume I had the following object with the property exposed called Firstname. type Person(Firstname : string, Lastname : string) = member v.Firstname = Firstname I could extend the Firstname property with the following code and everything would be hunky dory… type Person(Firstname : string, Lastname : string) = member v.Firstname = Console.WriteLine("Side Effect") Firstname   All that this would do is each time I use the property Firstname, I would see the side effect printed to the screen saying “Side Effect”. Member methods have a very similar look & feel to properties, in fact the only difference really is that you declare that parameters are being passed in. type Person(Firstname : string, Lastname : string) = member v.FullName(middleName) = Firstname + " " + middleName + " " + Lastname   In the code above, FullName requires the parameter middleName, and if viewed from another project in C# would show as a method and not a property. Precomputation Optimizations Okay, so something that is obvious once you think of it but that poses an interesting side effect of mutable value holders is pre-computation of results. All it is, is a slight difference in code but can result in quite a huge saving in performance. Basically pre-computation means you would not need to compute a value every time a method is called – but could perform the computation at the creation of the object (I hope I have got it right). In a way I battle to differentiate this from lazy evaluation but I will show an example to explain the principle. Let me try and show an example to illustrate the principle… assume the following F# module namespace myNamespace open System module myMod = let Add val1 val2 = Console.WriteLine("Compute") val1 + val2 type MathPrecompute(val1 : int, val2 : int) = let precomputedsum = Add val1 val2 member v.Sum = precomputedsum type MathNormalCompute(val1 : int, val2 : int) = member v.Sum = Add val1 val2 Now assume you have a C# console app that makes use of the objects with code similar to the following… using System; using myNamespace; namespace CSharpTest { class Program { static void Main(string[] args) { Console.WriteLine("Constructing Objects"); var myObj1 = new myMod.MathNormalCompute(10, 11); var myObj2 = new myMod.MathPrecompute(10, 11); Console.WriteLine(""); Console.WriteLine("Normal Compute Sum..."); Console.WriteLine(myObj1.Sum); Console.WriteLine(myObj1.Sum); Console.WriteLine(myObj1.Sum); Console.WriteLine(""); Console.WriteLine("Pre Compute Sum..."); Console.WriteLine(myObj2.Sum); Console.WriteLine(myObj2.Sum); Console.WriteLine(myObj2.Sum); Console.ReadKey(); } } } The output when running the console application would be as follows…. You will notice with the normal compute object that the system would call the Add function every time the method was called. With the Precompute object it only called the compute method when the object was created. Subtle, but something that could lead to major performance benefits. So… this post has gone off in a slight tangent but still related to F# objects.

    Read the article

< Previous Page | 1 2 3 4  | Next Page >