1,437 research outputs found
Generic programming in Scala
Generic programming is a programming methodology that aims at producing
reusable code, defined independently of the data types on which it is operating. To
achieve this goal, that particular code must rely on a set of requirements known
as concepts. The code is only functional for the set of data types that fulfill the
conditions established by its concepts. Generic programming can facilitate code reuse
and reduce testing.
Generic programming has been embraced mostly in the C++ community; major
parts of the C++ standard library have been developed following the paradigm. This
thesis is based on a study (by Garcia et al.) on generic programming applied to other
languages (C#, Eiffel, Haskell, Java and ML). That study demonstrated that those
languages are lacking in their support for generic programming, causing diffculties
to the programmer.
In this context, we investigate the new object-oriented language Scala. This
particular language appealed to our interest because it implements "member types"
which we conjecture to fix some of the problems of the languages surveyed in the
original study. Our research shows that Scala's member types are an expressive
language feature and solve some but not all of the problems identified in the original
study (by Garcia et al.).
Scala's members types did not resolve the problem of adding associated types to
the parameter list of generic methods. This issue led to repeated constraints, implicit instantiation failure and code verbosity increase. However, Scala's member types
enabled constraint propagation and type aliasing, two significantly useful generic
programming mechanisms
Synthesis of Recursive ADT Transformations from Reusable Templates
Recent work has proposed a promising approach to improving scalability of
program synthesis by allowing the user to supply a syntactic template that
constrains the space of potential programs. Unfortunately, creating templates
often requires nontrivial effort from the user, which impedes the usability of
the synthesizer. We present a solution to this problem in the context of
recursive transformations on algebraic data-types. Our approach relies on
polymorphic synthesis constructs: a small but powerful extension to the
language of syntactic templates, which makes it possible to define a program
space in a concise and highly reusable manner, while at the same time retains
the scalability benefits of conventional templates. This approach enables
end-users to reuse predefined templates from a library for a wide variety of
problems with little effort. The paper also describes a novel optimization that
further improves the performance and scalability of the system. We evaluated
the approach on a set of benchmarks that most notably includes desugaring
functions for lambda calculus, which force the synthesizer to discover Church
encodings for pairs and boolean operations
The C++0x "Concepts" Effort
C++0x is the working title for the revision of the ISO standard of the C++
programming language that was originally planned for release in 2009 but that
was delayed to 2011. The largest language extension in C++0x was "concepts",
that is, a collection of features for constraining template parameters. In
September of 2008, the C++ standards committee voted the concepts extension
into C++0x, but then in July of 2009, the committee voted the concepts
extension back out of C++0x.
This article is my account of the technical challenges and debates within the
"concepts" effort in the years 2003 to 2009. To provide some background, the
article also describes the design space for constrained parametric
polymorphism, or what is colloquially know as constrained generics. While this
article is meant to be generally accessible, the writing is aimed toward
readers with background in functional programming and programming language
theory. This article grew out of a lecture at the Spring School on Generic and
Indexed Programming at the University of Oxford, March 2010
Numerical Integration and Dynamic Discretization in Heuristic Search Planning over Hybrid Domains
In this paper we look into the problem of planning over hybrid domains, where
change can be both discrete and instantaneous, or continuous over time. In
addition, it is required that each state on the trajectory induced by the
execution of plans complies with a given set of global constraints. We approach
the computation of plans for such domains as the problem of searching over a
deterministic state model. In this model, some of the successor states are
obtained by solving numerically the so-called initial value problem over a set
of ordinary differential equations (ODE) given by the current plan prefix.
These equations hold over time intervals whose duration is determined
dynamically, according to whether zero crossing events take place for a set of
invariant conditions. The resulting planner, FS+, incorporates these features
together with effective heuristic guidance. FS+ does not impose any of the
syntactic restrictions on process effects often found on the existing
literature on Hybrid Planning. A key concept of our approach is that a clear
separation is struck between planning and simulation time steps. The former is
the time allowed to observe the evolution of a given dynamical system before
committing to a future course of action, whilst the later is part of the model
of the environment. FS+ is shown to be a robust planner over a diverse set of
hybrid domains, taken from the existing literature on hybrid planning and
systems.Comment: 17 page
Domain Specific Languages for Managing Feature Models: Advances and Challenges
International audienceManaging multiple and complex feature models is a tedious and error-prone activity in software product line engineering. Despite many advances in formal methods and analysis techniques, the supporting tools and APIs are not easily usable together, nor unified. In this paper, we report on the development and evolution of the Familiar Domain-Specific Language (DSL). Its toolset is dedicated to the large scale management of feature models through a good support for separating concerns, composing feature models and scripting manipulations. We overview various applications of Familiar and discuss both advantages and identified drawbacks. We then devise salient challenges to improve such DSL support in the near future
Role-Modeling in Round-Trip Engineering for Megamodels
Software is becoming more and more part of our daily life and makes it easier, e.g., in the areas of communication and infrastructure. Model-driven software development forms the basis for the development of software through the use and combination of different models, which serve as central artifacts in the software development process. In this respect, model-driven software development comprises the process from requirement analysis through design to software implementation.
This set of models with their relationships to each other forms a so-called megamodel. Due to the overlapping of the models, inconsistencies occur between the models, which must be removed. Therefore, round-trip engineering is a mechanism for synchronizing models and is the foundation for ensuring consistency between models. Most of the current approaches in this area, however, work with outdated batch-oriented transformation mechanisms, which no longer meet the requirements of more complex, long-living, and ever-changing software. In addition, the creation of megamodels is time-consuming and complex, and they represent unmanageable constructs for a single user.
The aim of this thesis is to create a megamodel by means of easy-to-learn mechanisms and to achieve its consistency by removing redundancy on the one hand and by incrementally managing consistency relationships on the other hand. In addition, views must be created on the parts of the megamodel to extract them across internal model boundaries.
To achieve these goals, the role concept of KĂĽhn in 2014 is used in the context of model-driven software development, which was developed in the Research Training Group 'Role-based Software Infrastructures for continuous-context-sensitive Systems.' A contribution of this work is a role-based single underlying model approach, which enables the generation of views on heterogeneous models. Besides, an approach for the synchronization of different models has been developed, which enables the role-based single underlying model approach to be extended by new models. The combination of these two approaches creates a runtime-adaptive megamodel approach that can be used in model-driven software development.
The resulting approaches will be evaluated based on an example from the literature, which covers all areas of the work. In addition, the model synchronization approach will be evaluated in connection with the Transformation Tool Contest Case from 2019
Improving support for generic programming in C# with associated types and constraint propagation
Generics has recently been adopted to many mainstream object oriented languages,
such as C# and Java. As a particular design choice, generics in C# and Java
use a sub-typing relation to constraint type parameters. Failing to encapsulate type
parameters within generic interfaces and inability to encapsulate type constraints as
part of an interface definition have been identified as deficiencies in the way this design
choice has been implemented in these languages. These deficiencies can lead to
verbose and redundant code. In particular, they have been reported to affect the
development of highly generic libraries. To address these issues, extending object
oriented interfaces and sub-typing with associated types and constraint propagation
has been proposed and studied in an idealized small-scale formal setting. This thesis
builds on this previous work and provides a design and implementation of the
extensions in full C#. We also present a proof of soundness of the Featherweight
Generic Java (FGJ) formalism extended with interfaces. This property was assumed
in a proof of type safety of associated types and constraint propagation, but no proof
for the property was provided
Errors as Data Values
A “thrown” exception is a non-local side effect that complicates static reasoning about code. Particularly in functional languages it is fairly common to instead propagate errors as ordinary values. The propagation is sometimes done in monadic style, and some languages include syntactic conveniences for writing expressions in that style. We discuss a guarded- algebra-inspired approach for integrating similar, implicit error propagation into a language with “normal” function application syntax. The presented failure management approach accommodates language designs with all- referentially-transparent expressions. It furthermore supports automatically checking data invariants and function pre- and post-conditions, recording a trace of any due-to-an-error unevaluateable or failed expressions, and in some cases retaining “bad” values for potential use in recovering from an error
- …