Questions tagged [variable-binding]

18 questions
10
votes
1 answer

Can I bind multiple variables at once?

The following line declares a variable and binds it to the number on the right-hand side. my $a := 42; The effect is that $a is not a Scalar, but an Int, as can be seen by say $a.VAR.^name; My question is, can I bind multiple variables in one…
Nikola Benes
  • 2,372
  • 1
  • 20
  • 33
10
votes
1 answer

Really binding an argument to a parameter? (Perl6)

The Perl6 docs state "By default, parameters are bound to their argument and marked as read-only." But running the following code: # Example 1 sub f1 ( $x ) { say $x.VAR.WHAT; say $x.WHAT; say $x } f1(1); yields: (Scalar) (Int) 1 while this…
ozzy
  • 785
  • 3
  • 12
7
votes
3 answers

What are the rules for re-binding?

[NOTE: I asked this question based on an older version of Rakudo. As explained in the accepted answer, the confusing output was the result of Rakudo bugs, which have now been resolved. I've left the original version of the Q below for historical…
codesections
  • 8,900
  • 16
  • 50
7
votes
2 answers

Binding a scalar to a sigilless variable (Perl 6)

Let me start by saying that I understand that what I'm asking about in the title is dubious practice (as explained here), but my lack of understanding concerns the syntax involved. When I first tried to bind a scalar to a sigilless symbol, I did…
ozzy
  • 785
  • 3
  • 12
5
votes
1 answer

Should sigilless "variables" with type constraints be re-bindable?

[EDIT: closed in favor of https://stackoverflow.com/questions/69231506/what-are-the-rules-for-re-binding, which I formulated after more clearly understanding what I was trying to ask in this question.] My understanding from Is there a purpose or…
codesections
  • 8,900
  • 16
  • 50
5
votes
3 answers

angular 6 variable or method binding in *ngIf

Is there any difference between binding a variable and binding a method in template *ngIf. Ex: Case 1:
ABC
Case 2:
ABC
myFunction() : boolean { if (cond1 && cond2 && cond3) { …
2
votes
3 answers

Lexical vs Dynamic interpreter in Scheme language

I still do not understand how a dynamic interpreter differ from a lexical one. I am working on scheme and i find it very difficult to know how a simple code like these one works dynamically and lexically. (define mystery (let ((x 2018)) …
1
vote
2 answers

Defer, return and Argument evaluation in golang

package main import "fmt" // fibonacci is a function that returns // a function that returns an int. func fibonacci() func() int { a, b := 0, 1 return func() int { defer func() {a, b = b, a + b}() return a } } func…
likecs
  • 353
  • 2
  • 13
1
vote
2 answers

Avoid Angular/TypeScript variable binding

I need to create a clone of my object, without creating it's reference. When I try to copy EquipmentClass, witch is my main object to it's clone, and if I change some property of EquipmentClass it will change my EquipmentClassCloneEdit also. And I…
Felipe Thomé
  • 353
  • 3
  • 12
1
vote
0 answers

Eclipse JDT resolve binding not working with copy of ASTNode

I have a code where I am replacing a logical expression with its negated form. Like, replacing A || B with !A && !B. For this, I am using JDT ASTNode's copySubtree() function to make a copy of the original node. Then modifying the copy and replacing…
1
vote
0 answers

Raise an exception on assignment

Is there any way to prevent a name from being bound, or a variable from being rebound? For instance, given a foo variable, is it possible to have an assignment operation raise an exception? More concretely, provided we have a total control on foo's…
Right leg
  • 16,080
  • 7
  • 48
  • 81
0
votes
1 answer

How can I use oracle variable binding within IN-keyword

I use variable binding in ORACLE with java/groovy like these: String sql = "SELECT * FROM myTable WHERE id = :id" sqlConnection.query(sql, [id: 111]) It works perfect. But when I try the same with an IN-keyword I got an error: String sql = "SELECT…
Steffen S
  • 17
  • 1
  • 5
0
votes
0 answers

How to rewrite this lambda so it circumvents latebinding

Problem As far as I'm aware, this undesired behaviour (by my standards) happens, because of late-binding in contrast to early binding in the loop. That is, when the lambda function is called, the iterator variables all have the same values, namely…
infinitezero
  • 1,610
  • 3
  • 14
  • 29
0
votes
1 answer

Using bound argument name inside python function

My current hackish manner of printing multiple arrays in columns uses keyword arguments to label the output: def table(**data_dict): n=([len(x) for x in data_dict.values()]) # # data for each var N=max(n) # prep data & print headings …
0
votes
1 answer

map php array keys explicitly to db columns (oracle)

I am passing data from PHP to sql in the form of arrays that look like below: var_dump($data); array( key_id => 'CLA-ARTCC'(length=9) key2 => 'ZLA'length=3) key3 => 'LOS ANGELES ACTCC'(length=17) key4 => 'ACTCC'(length=5) key5…
Dr Upvote
  • 8,023
  • 24
  • 91
  • 204
1
2