dsl

Apache Camel: Is it possible to configure WMQ without using Spring?

风格不统一 提交于 2019-12-03 22:02:40
问题 currently I am working with apache camel and wmq. For the camel configuration and routing, I am using Java DSL. But I could not find any example about how to configure WMQ by using Java DSL. Here is what I get when I tried to configure WMQ: config.xml <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xmlns:jdbc="http://www

Writing my first DSL in C# and getting hung up on func<T> & Action

心已入冬 提交于 2019-12-03 19:34:50
问题 I'm taking a crack at writing my first DSL for a simple tool at work. I'm using the builder pattern to setup the complex parent object but am running into brick walls for building out the child collections of the parent object. Here's a sample: Use: var myMorningCoffee = Coffee.Make.WithCream().WithOuncesToServe(16); Sample with closure (I think that's what they're called): var myMorningCoffee = Coffee.Make.WithCream().PourIn( x => { x.ShotOfExpresso.AtTemperature(100); x.ShotOfExpresso

Is something in Swift like LINQ in C#

主宰稳场 提交于 2019-12-03 18:22:42
问题 I know that Swift is relatively new yet, but I would like to know if Swift have anything like LINQ in C#? With LINQ I mean all the excellent tools like Standard Query Operators , Anonymous types, Object Initializer , etc. 回答1: Swift incorporates several of the features that are bundled together in .net as LINQ, though possibly not in quite an out-of-the-box sense. Anonymous types are quite close to tuples with named values in Swift. In C#: var person = new { firstName = "John", lastName =

Using Python functions in Tkinter.Tcl()

有些话、适合烂在心里 提交于 2019-12-03 17:35:40
I have a bunch of Python functions. Let's call them foo , bar and baz . They accept variable number of string arguments and does other sophisticated things (like accessing the network). I want the "user" (let's assume he is only familiar with Tcl) to write scripts in Tcl using those functions. Here's an example (taken from Macports ) that user can come up with: post-configure { if {[variant_isset universal]} { set conflags "" foreach arch ${configure.universal_archs} { if {${arch} == "i386"} {append conflags "x86 "} else { if {${arch} == "ppc64"} {append conflags "ppc_64 "} else { append

Domain-specific languages vs. library of functions

ぐ巨炮叔叔 提交于 2019-12-03 15:44:11
问题 This may be subjective, I don't know: I have this problem, which I'm kind of equating to the "what language for this project?" question, since I can't seem to solve it. I've been commisioned to write a book about a certain domain (let's say a very specific branch of physics) for a very technically savvy community, but who are not programmers. It is a book on this subset of algorithms that they use day in day out. For this, given my audience, I've been toying with the idea of defining a DSL,

Scala DSL: method chaining with parameterless methods

房东的猫 提交于 2019-12-03 14:34:12
i am creating a small scala DSL and running into the following problem to which i dont really have a solution. A small conceptual example of what i want to achieve: (Compute write "hello" read 'name calc() calc() write "hello" + 'name ) the code defining this dsl is roughly this: Object Compute extends Compute{ ... implicit def str2Message:Message = ... } class Compute{ def write(msg:Message):Compute = ... def read(s:Symbol):Compute = ... def calc():Compute = { ... } } Now the question: how can i get rid of these parenthesis after calc? is it possible? if so, how? just omitting them in the

Which language (that runs on JVM) is best suited for creating a DSL?

二次信任 提交于 2019-12-03 13:00:04
问题 We have a requirement to create complex fixed length and variable length Strings. These strings might represent a customer profile, an order etc. Which JVM based programming language do you guys suggest? Idea is for a end user to create the strings using this DSL. So I am looking for validation, code completion etc. 回答1: With Xtext (http://www.eclipse.org/Xtext/) you get a nice editor for free when specifying your DSL. 回答2: Groovy http://docs.codehaus.org/display/GROOVY/Writing+Domain

How do I create an “OR” filter using elasticsearch-dsl-py?

强颜欢笑 提交于 2019-12-03 12:58:58
The query below is what I would like to construct using elasticsearch-dsl-py, but I do not know how to do it. GET /my_index/_search { "query": { "filtered": { "filter": { "bool": { "must": [ { "term": { "status": "published" } }, { "or": { "filters": [ { "range": { "start_publication": { "lte": "2015-02-17T03:45:00.245012+00:00" } } }, { "missing": { "field": "start_publication" } } ] } }, { "or":{ "filters": [ { "range": { "end_publication": { "gte": "2015-02-17T03:45:00.245012+00:00" } } }, { "missing": { "field": "end_publication" } } ] } } ] } } } } } Using elasticsearch-dsl-py, this is as

Xtext example of a scoped object

五迷三道 提交于 2019-12-03 12:57:24
问题 I'm looking for an example (in XText) of how to implement code completion on an user defined objects members. As far as I can see I need to use IScope, but how all this wires together is unclear. Given that trait is a user defined type, how do I go about building a grammar to code complete / validate the methods contained within String when I type name. ? trait String { def toLowerCase(): String def toUpperCase(): String } val name = new String() name.toLowerCase() Thanks 回答1: It highly

Use of Clojure macros for DSLs

人走茶凉 提交于 2019-12-03 12:32:00
I am working on a Clojure project and I often find myself writing Clojure macros for DSLs, but I was watching a Clojure video of how a company uses Clojure in their real work and the speaker said that in practical use they do not use macros for their DSLs, they only use macros to add a little syntactic sugar. Does this mean I should write my DSL in using standard functions and then add a few macros at the end? Update : After reading the many varied (and entertaining) responses to this question I have realized that the answer is not as clear cut as I first thought, for many reasons: There are