Declarative programming is a paradigm of expressing the logic of a computer program or computation without explicit describing its control flow.
Questions tagged [declarative]
365 questions
15
votes
3 answers
Difference between 'kubectl apply' and 'kubectl create'
I created a pod with kubectl create -f pod.xml and kubectl apply -f pod.xml using the below yaml and I don't see any difference, a pod gets created with both the commands. The K8S document, mentions imperative and declarative commands. But, still…

Praveen Sripati
- 32,799
- 16
- 80
- 117
15
votes
4 answers
C++ Declarative Parsing Serialization
Looking at Java and C# they manage to do some wicked processing based on special languaged based anotation (forgive me if that is the incorrect name).
In C++ we have two problems with this:
1) There is no way to annotate a class with type…

Martin York
- 257,169
- 86
- 333
- 562
14
votes
2 answers
SQLAlchemy Declarative + relationships across multiple different databases
It took me a while, but I figured out how to use SQLAlchemy to model a relationship across two different kinds of databases:
Base = declarative_base()
class Survey(Base):
__tablename__ = 'SURVEY'
survey_id =…

coredumperror
- 8,471
- 6
- 33
- 42
14
votes
2 answers
flutter: how to handle back button press when using navigator with pages
I am trying to implement Navigator 2.0 method. The only thing I can't make to work is the back button presses. When I press the back button, the app just exits and not going to the previous page. I tried the WillPopPage widget but back button…

Midhunraj R Pillai
- 484
- 1
- 3
- 16
13
votes
4 answers
SQLAlchemy declarative syntax with autoload (reflection) in Pylons
I would like to use autoload to use an existings database. I know how to do it without declarative syntax (model/_init_.py):
def init_model(engine):
"""Call me before using any of the tables or classes in the model"""
t_events =…

Juliusz Gonera
- 4,658
- 5
- 32
- 35
13
votes
1 answer
Why aren't OSGi Declarative Services (DS) annotations inherited from super classes?
The OSGi Declarative Services (DS) specifications define annotations which can be processed by tools, like Bnd, into the component description xml which is used at runtime. 112.8.1 in the R6 spec says:
The Component Annotations are not inherited,…

BJ Hargrave
- 9,324
- 1
- 19
- 27
12
votes
8 answers
Generic Declarative Expression Builder in PHP
Folks,
I'm looking to build a piece of PHP5 UI that I'm pretty sure is common to a bunch of applications. Basically, it's an expression builder that allows users to specify expressions combined through logical operators (AND/OR), like this:
FieldX…

Alex Weinstein
- 9,823
- 9
- 42
- 59
12
votes
4 answers
Is it OK to execute code when a module imports?
I'm designing a small GUI application to wrap an sqlite DB (simple CRUD operations). I have created three sqlalchemy models (m_person, m_card.py, m_loan.py, all in a /models folder) and had previously had the following code at the top of each…

johnharris85
- 17,264
- 5
- 48
- 52
12
votes
3 answers
What is build-by-convention in Gradle deep explanation?
The Gradle User Guide often mentions that Gradle is declarative and uses build-by-convention. What does this mean?
From what I understand it means that, for example, in java plugin there are conventions like
source must be in src/main/java,tests…

Xelian
- 16,680
- 25
- 99
- 152
11
votes
3 answers
SQLAlchemy declarative many-to-many self-join via Association object
I have a table Users and a table Friends which maps users to other users as each user can have many friends. This relation is obviously symmetric: if user A is a friend of user B then user B is also a friend of user A, I only store this relation…

Janny
- 111
- 1
- 1
- 4
11
votes
1 answer
SwiftUI: Change @State variable through a function called externally?
So maybe I'm misunderstanding how SwiftUI works, but I've been trying to do this for over an hour and still can't figure it out.
struct ContentView: View, AKMIDIListener {
@State var keyOn: Bool = false
var key: Rectangle = Rectangle()
…

Thor Correia
- 1,159
- 1
- 12
- 20
11
votes
3 answers
Is it possible to unload declarative classes in SQLAlchemy?
I’m working on a library where the user shall be able to simply declare a few classes which are automatically backed by the database. In short, somewhere hidden in the code, there is
from sqlalchemy.ext.declarative import declarative_base
Base =…

Debilski
- 66,976
- 12
- 110
- 133
11
votes
4 answers
Limit child collections in initial query sqlalchemy
I am building an api which can return children of resources if the user requests it. For example, user has messages. I want the query to be able to limit the number of message objects that are returned.
I found a useful tip aboutl imiting the number…

melchoir55
- 6,842
- 7
- 60
- 106
11
votes
4 answers
Generic Data Structure Description Language
I am wondering whether there exists any declarative language for arbitrarily describing the format and semantics of a data structure, that can be compiled to a specific implementation of that structure in any of a set of target languages. That is,…

Jon Purdy
- 53,300
- 8
- 96
- 166
10
votes
4 answers
I'm curious if Logic Programs can do algebra
I read a brief article about Prolog and Logic Programming. I'm curious if Logic Programs can do algebra. Like would you be able to ask what the Variable of X is in the equation 5+X = 7 and get an answer of -2?

James Scourtos
- 691
- 6
- 7