|
For my programming languages course, I'm trying to write some code snippets in languages that use pass by name or pass by value-result, preferably by default, but any language that even supports either of those would be fine. However, I haven't been able...
Started by dancavallaro on
, 6 posts
by 6 people.
Answer Snippets (Read the full thread at stackoverflow):
If you pass a variable to a fortran function/classes.doc.html#374....
Call-by-name is supported by algol 68.
I don't know of any pass by fortran.
I think C Macros are Pass-by-name ( not the C language itself of course).
|
|
I want to know if it's possible to retrieve the variables name from when it was passed into a certain function. For example, if I call parseId(myId) to a function with the signature parseId(id) , i can obviously retrieve the value of 'id'. However, is...
Started by Chris on
, 4 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
I); } static void WriteLine<T>(Expression<Func<T>> expression) { string name; switch (expression.Body.NodeType) { case ExpressionType.MemberAccess: name = ((MemberExpression)expression.Body = expression.Compile()(); Console....
|
|
Well, the title says it all. When passing a file name to a method, should I use a FileInfo object or a plain file name (string)? Why would I prefer one to the other?
Some of my colleagues like to write method like this:
void Export(FileInfo fileInfo) ...
Started by Martin on
, 11 posts
by 11 people.
Answer Snippets (Read the full thread at stackoverflow):
However, there's ....
The difference.
However, you could overload the method to make everyone happy .
Typically I would pass the string.
I think file name will suffice if it is doing the same thing.
In the argument name what it is.
|
Ask your Facebook Friends
|
Here's what I want to do:
public function all($model) { $query = 'SELECT ' . implode(', ', $model::$fields) ....; }
Called like this:
$thing->all(Account);
I get this error:
Parse error: syntax error, unexpected T_PAAMAYIM_NEKUDOTAYIM in /home/mark...
Started by Mark A. Nicolosi on
, 5 posts
by 5 people.
Answer Snippets (Read the full thread at stackoverflow):
If you are working with non-static methods (seems you are), you should use $this , instead in a variable) class name -- see the examples on the page Static Keyword : they only work with PHP 5.3 a first-class citizen by using a string....
name.
|
|
I have a function that gets a class passed to it as a parameter. I would like to get the class name of the passed class as a string.
I tried putting this method in the passed class:
function getClassName() { return __CLASS__; }
but if the class is extended...
Started by John Isaacks on
, 6 posts
by 6 people.
Answer Snippets (Read the full thread at stackoverflow):
If you want to get the class name of an object ....
$class_name = get_class($object);
__ CLASS __ with return the name of the class the method is implemented in.
See get_class , that should be exactly what you're trying to achieve .
|
|
I've check wikipedia, and googled but I still can't wrap my mind around how pass-by-name works in ALGOL 60.
Thanks!
Started by Paperino on
, 5 posts
by 5 people.
Answer Snippets (Read the full thread at stackoverflow):
Essentially, the body of a function is that since with pass-by-name the parameter is evaluated inside the function, a parameter at a[i] before the function....
I found a good explanation at Pass-By-Name Parameter Passing .
|
|
How can I pass a functions name to a function and then call it? Is it possible to do this without using getattribute ?
How can I pass a class name to a function and then instantiate the class? I know I just could pass the instance of the class directly...
Started by self.name on
, 5 posts
by 5 people.
Answer Snippets (Read the full thread at stackoverflow):
Def outer(f): # any name: function, class, any callable return f() # class will be instantiated the function and the class directly?
class A(object): pass def f(): pass def g(func, cls): func() x = cls() g(f, A)
namespace = globals....
|
|
Say I have the following 2 methods:
def methodA(arg, **kwargs): pass def methodB(arg, *args, **kwargs): pass
In methodA I wish to call methodB, passing on the kwargs. However, it seems if I simply do:
def methodA(arg, **kwargs): methodB("argvalue", kwargs...
Started by Staale on
, 4 posts
by 4 people.
Answer Snippets (Read the full thread at stackoverflow):
This makes Python pass.
Put the asterisks before the kwargs variable.
", **kwargs)
Seems obvious now...
|
|
I have a C# method that takes a string as an argument, that string contains the name of a static method e.g
"MyClass.GetData"
Is it possible to run that method from the value passed in the string?
Started by Gavin Draper on
, 9 posts
by 9 people.
Answer Snippets (Read the full thread at stackoverflow):
From that, you can use the Invoke = method_full_path.Split('.'); string class_full_name = String.Format("{0}.{1}", tokens[0], tokens[1]); var class_blueprint = Assembly.GetExecutingAssembly....
That would return to you a MethodInfo class.
Is the string name.
|
|
Hi,
I would like to select several files on my desktop (or any other folder) and pass their names to my application.
More specifically, I've added a key to the registry such that when I right click on a jpeg file I see a new "Transform" option that actually...
Answer Snippets (Read the full thread at stackoverflow):
To illustrate:
static void Main(string[] args) { if (args.Length....
In your Main function that has a parameter of string[] args .
Look at the command line arguments passed to your application at start up.
They should be passed by windows.
|