« first day (3166 days earlier)      last day (1776 days later) » 

12:01 AM
@CapricaSix hi
@Rob hi
@mr5 had a lively discussion about js and c# being typed or not
 
What did you mean when you said "javascript doesn't have delegates."?
 
when you want to write an anonymous or local method you can just do so. you don't use a delegate
probably has to do with typing
	Func<int, int> sqr = x => x * x;

	Transformer<int> sqr2 = x => x * x;
i would never need to do that in javascript
delegate T Transformer<T> (T arg);
learning typescript is how I got to wanting to learn C#
 
12:23 AM
@ChristianMatthew How is that different than C#?
 
typescript?
 
The only difference I know (besides syntax) is that JS doesn't use the name "delegate"
 
delegate T Transformer<T> (T arg);
what purpose does this serve?
 
That defines a new type
 
exactly
that doesn't happen in javascript
if I want to use this method
 static int Square(int x) =>
	x * x;
 
12:26 AM
Oh, that's because JS doesn't have static types
 
Rob
The delegate keyword is rarely used in C# these days. But one benefit it has over Func/Action is you can name the arguments
 
Nothing to do with functions
When you add static typing (TS) then you get back to being able to define new types
 
@Rob what I was reading is that local methods are preferred... but 2 things. a lot of the framework has already been written with delegates and delegates or Func/Action are better for closure creation
i.e. functions as parameters
but you wouldn't' consider a local method a delegate would you?
 
Rob
Nope
A delegate is a wrapper around a function pointer
 
so would you say that a Func / Action are like anonymous delegates where they act almost like the var keyword
but still give generic typing of inputs and outputs
 
Rob
12:34 AM
Not sure what you mean by acting like the var keyword
 
because I can do this
var x = (x) => x * x;
or in C# it would be this
Func<int, int> sqr = x => x * x;
I can't do this is in C#
var sqr3 = x => x * x;
 
The reason you can't do that is not because of delegates, but because of expression trees
lambda expressions can be compiled to expression trees, which are not delegates/functions.
 
either way
i can locally variable with the var keyword a method
can't
 
Rob
Not with the var keyword. But you can pass it to a function without explicitly typing. For example, you can write DoSomething(x => x * x). You can't assign it to var because C# can't figure out what you're constructing
x => x * x can represent an expression tree, or a Func<T, TT>. And in addition, it doesn't know what T or TT are
 
that's why I said Func is like var but with typing
because Func doesn't care about a predefined delegate
 
Rob
12:48 AM
Func and var are completely different
 
and the lambda expression is just an anonymous method
 
Rob
var is a keyword for the compiler to automatically determine the type
Func is a function pointer
 
Func is just a wrapper for a delegate?
 
Rob
No
 
or rather it creates a delegate in memory
 
Rob
12:50 AM
A 'delegate' in programming is a wrapper around a function pointer. It can also add additional functionality, like multi casting
 
Func ultimately creates a delegate
 
Rob
The c# delegate keyword is a type of delegate
 
Rob
Func is a delegate, but not a c# delegate
 
PourCoffeeAsync
The Func and Action Delegates
With generic delegates, it becomes possible to write a small set of delegate types that
are so general they can work for methods of any return type and any (reasonable)
number of arguments. These delegates are the Func and Action delegates, defined
in the System namespace (the in and out annotations indicate variance, which we
will cover shortly):
delegate TResult Func <out TResult> ();
delegate TResult Func <in T, out TResult> (T arg);
delegate TResult Func <in T1, in T2, out TResult> (T1 arg1, T2 arg2);
these seem like c# delegates that are just overloaded
 
Rob
1:01 AM
Huh. You're right, they are indeed c# delegates. Wasn't aware of that
Which means they also support multi casting... interesting
 
i glazed over multi-casting
 
Rob
Func<int, int> a = x => { Console.WriteLine(x); return x; };
a += x => { Console.WriteLine(x * 2); return 15; };

var result = a(10);
 
so a single delegate targeting multiple methods
what is this implying
@Rob
ApplyButter(toast);
 
Rob
1:19 AM
?
 
i'm actually trying to recreate this
and it was very confusing the method return a class part
here is the list of tasks to complete
static void Main(string[] args)
{
    Coffee cup = PourCoffee();
    Console.WriteLine("coffee is ready");
    Egg eggs = FryEggs(2);
    Console.WriteLine("eggs are ready");
    Bacon bacon = FryBacon(3);
    Console.WriteLine("bacon is ready");
    Toast toast = ToastBread(2);
    ApplyButter(toast);
    ApplyJam(toast);
    Console.WriteLine("toast is ready");
    Juice oj = PourOJ();
    Console.WriteLine("oj is ready");

    Console.WriteLine("Breakfast is ready!");
}
i'm not sure what ApplyButter(toast) is supposed to represent
 
Rob
A function that depends on toast
 
Rob
ApplyButter and ApplyJam can't execute until ToastBread() is finished
 
ok i have some work done
i'll show you
 
1:24 AM
morning
 
lol omg the more I look at the word toast the more i feel like that is the wrong spelling
static async Task Main(string[] args)
{
	Coffee cup = PourCoffeeAsync(500);
	Console.Write("Coffee is ready\r\n");

	Egg eggs = FryEggsAsync(2000);
	Console.Write("Eggs are ready\r\n");

	Bacon bacon = FryBaconAsync(4000);
	Console.Write("Bacon is ready\r\n");

	Toast toast = ToastBreadAsync(2000);
	ApplyButter(toast);
	ApplyJam(toast);
	Console.Write("toast is ready\r\n");

	Console.Write("Breakfast is ready!");
}

public static Coffee PourCoffeeAsync(int x)
{
	string cookingAction = "Pouring Coffee";
ok this is what I have come up with so far for the synchronous example
 
1:46 AM
what is this returning exactly
ApplyButter(toast);
how can I make the toast return be an integer i.e. 1000
CS1061 'UserQuery.Egg' does not contain a definition for 'GetAwaiter' and no extension method 'GetAwaiter' accepting a first argument of type 'UserQuery.Egg' could be found (press F4 to add a using directive or assembly reference)
when i am trying to switch them to async I am getting this error
 
2:18 AM
@Rob do you know about stopwatch
 
Rob
Sure
 
well maybe i don't need stopwatch
is there a way to create work that is non-blocking on the thread
i think sleep and delay are blocking
 
Rob
Sleep blocks the thread, delay won't
 
static async Task Main(string[] args)
{
	Coffee cup = PourCoffeeAsync(500);
	Console.Write("coffee is ready\r\n");

	Egg eggs = await FryEggsAsync(2000);
	Console.Write("eggs are ready\r\n");

	Bacon bacon = await FryBaconAsync(4000);
	Console.Write("bacon is ready\r\n");

	Toast toast = await ToastBreadAsync(2000);
	ApplyButter(toast);
	ApplyJam(toast);
	Console.Write("toast is ready\r\n");

	Juice oj = PourOjAsync(1500);
	Console.Write("oj is ready\r\n");

	Console.Write("Breakfast is ready!");
this seems to be blocking.
everything is happening in sequence
 
Rob
Yes, because you're awaiting in sequence
Check the tutorial you linked a little further down
It discusses re-ordering the awaits
 
2:22 AM
but when I don't use the await it doesn't delay
 
Rob
Well, yes, it's a task that will produce a result after x amount of time
 
so how can i represent a work of time that is not blocking
 
Rob
With delay
 
meaning even though time is elapsing
static async Task Main(string[] args)
{
	Coffee cup = PourCoffeeAsync(500);
	Console.Write("coffee is ready\r\n");

	Egg eggs = await FryEggsAsync(2000);
	Console.Write("eggs are ready\r\n");

	Bacon bacon = await FryBaconAsync(4000);
	Console.Write("bacon is ready\r\n");

	Toast toast = await ToastBreadAsync(2000);
	ApplyButter(toast);
	ApplyJam(toast);
	Console.Write("toast is ready\r\n");

	Juice oj = PourOjAsync(1500);
	Console.Write("oj is ready\r\n");

	Console.Write("Breakfast is ready!");
this is delay
 
Rob
It's printing in sequence because you're awaiting in sequence
See the tutorial further down
Where they create tasks at the start, and then await them later
Also...
delay.Result is going to block
 
2:27 AM
well you are right about 1 thing
delay.Result is the one that was blocking
now the actual delay doesn't work
 
Rob
I'm assuming you just removed the writeline?
 
i took out the param but essentially yes
 
Rob
Right. So in your code, you're starting a task
And then never referencing it again
If you change the signature to:
public static async Task<Coffee> PourCoffeeAsync(int x)
Then, you should await delay before returning the coffee
 
i have that with egg
 
Rob
Indeed... all your methods should await delay
return await Task.FromResult(new Egg());
You can just return new Egg()
await Task.FromResult() is going to wrap an item in a task, and then immediately unwrap it with await
 
2:35 AM
public static Coffee PourCoffeeAsync(int x)
{
	string cookingAction = "Pouring Coffee";
	var delay = Task.Run( async () => { Stopwatch sw = Stopwatch.StartNew();
                                    await Task.Delay(x);
                                    sw.Stop();
                                    return sw.ElapsedMilliseconds; });
	Console.WriteLine("{0} took {1} minutes to make:", cookingAction, delay.Result/1000);
	return new Coffee();
	//return await Task.FromResult("Eggs are ready");
}
i think the delay is doing anything
what I want is for the time to elapse with a rate limit of the highest time = max time
 
Rob
Hmm?
 
i want work done for a period of time that is non-blocking on the tread
 
Rob
Right. So you need to await the delay
 
what do you mean
where would I do that?
 
Rob
public static async Task<Coffee> PourCoffeeAsync(int x)
{
	string cookingAction = "Pouring Coffee";
	var delay = Task.Run(async () =>
	{
		Stopwatch sw = Stopwatch.StartNew();
		await Task.Delay(x);
		sw.Stop();
		return sw.ElapsedMilliseconds;
	});
	var duration = await delay;
	Console.WriteLine("{0} took {1} minutes to make:", cookingAction, duration / 1000);
	return new Coffee();
}
 
mr5
2:43 AM
Is the address convention similar to all European countries?
Address { Street, HouseNumber, PostalCode, City } ?
 
no way
that looks like US
 
mr5
Are you from Europe too?
 
i know you get funky stuff with overseas
 
mr5
I'm parsing an Address from Denmark
 
no i am from us but I travel a lot
 
Rob
2:45 AM
Don't forget apartment/unit numbers
 
mr5
Hmm good to know.
I'll ask our PM about that
 
public static Coffee PourCoffeeAsync(int x)
{
	string cookingAction = "Pouring Coffee";
	var delay = Task.Run( async () => { Stopwatch sw = Stopwatch.StartNew();
                                    await Task.Delay(x);
                                    sw.Stop();
                                    return sw.ElapsedMilliseconds; });
	Console.WriteLine("{0} took {1} minutes to make:", cookingAction, delay.Result/1000);
	return new Coffee();
	//return await Task.FromResult("Eggs are ready");
}
no it is doing the same thing
 
Rob
Because that's the same code you posted before
 
and duration isn't giving me back any number
 
Rob
You're still not awaiting the delay
You're blocking on .Result
 
2:47 AM
public static async Task<Egg> FryEggsAsync(int x)
{
	string cookingAction = "Frying Eggs";
	var delay = Task.Run( async () => { Stopwatch sw = Stopwatch.StartNew();
                                    await Task.Delay(x);
                                    sw.Stop();
                                    return sw.ElapsedMilliseconds; });
	var duration = await delay;
	Console.WriteLine("{0} took {0} minutes to make:", cookingAction, duration / 1000);
	return new Egg();
	//return await Task.FromResult("Eggs are ready");
that is just the first one
the rest are changed
and duration isn't giving any number
 
Rob
It's because you're returning 500. 500/1000 is integer division, giving 0
static async Task Main(string[] args)
{
	Coffee cup = await PourCoffeeAsync(5000);
	Console.Write("coffee is ready\r\n");

	Egg eggs = await FryEggsAsync(2000);
	Console.Write("eggs are ready\r\n");

	Console.Write("Breakfast is ready!");
}

public static async Task<Coffee> PourCoffeeAsync(int x)
{
	string cookingAction = "Pouring Coffee";
	var delay = Task.Run(async () =>
	{
		Stopwatch sw = Stopwatch.StartNew();
		await Task.Delay(x);
		sw.Stop();
		return sw.ElapsedMilliseconds;
	});
	var duration = await delay;
Prints:
Pouring Coffee took 5 minutes to make:
coffee is ready
Frying Eggs took 2 minutes to make:
eggs are ready
Breakfast is ready!
 
this is my printout
Pouring Coffee took 0 minutes to make:
coffee is ready
Frying Eggs took 2 minutes to make:
eggs are ready
Frying Bacon took 4 minutes to make:
bacon is ready
Toasting Bread took 2 minutes to make:
applying butter
applying jam
toast is ready
Pouring Oj took 1 minutes to make:
oj is ready
Breakfast is ready!
 
mr5
 
Rob
You're getting 0 because of integer division
Change the duration to > 1000
 
2:50 AM
oh no that's fine
i understand that
my issue is... this is taking 10 seconds to complete
it should only take 4 seconds to complete
 
Rob
Because you're awaiting them in order
The second task is only being created after the first one finishes
Again... go back to the tutorial and scroll down
It addresses this very thing :)
 
lol i think i see what you're saying. i am going to scroll down now
but i thought it was supposed to work like that
boom asynchronous
 
Rob
When you await a task, you're suspending execution of the rest of the method until the task produces a result
Thus.. you should create tasks, and then only await them when you need the result
 
but if you start them all at once
 
Rob
If you create them all before the first await, then yes, they're run as you expect
 
3:01 AM
wow
that works
static async Task Main(string[] args)
{
	Coffee cup = PourCoffeeAsync(500);
	Console.Write("coffee is ready\r\n");
	Task<Egg> eggTask = FryEggsAsync(2000);
	Task<Bacon> baconTask = FryBaconAsync(4000);
	Task<Toast> toastTask = ToastBreadAsync(2000);
	Toast toast = await toastTask;
	ApplyButter(toast);
	ApplyJam(toast);
	Console.Write("toast is ready\r\n");

	Juice oj = PourOjAsync(1500);
	Console.Write("oj is ready\r\n");

	Egg eggs = await eggTask;
	Console.Write("eggs are ready\r\n");
	Bacon bacon = await baconTask;
ok so in that next part 2 things occurred 1. we offloaded the method call / instantiation to Task's 2. we moved the await statements below the Task's
why did moving the await statements make this work
ohhh is it because the task's start together synchronously kicking off all of the events
 
Rob
Because everything below an await won't execute until the awaited task produces a result
 
ahhhh ok
 
mr5
Have anyone remember that boolean expression law to simplify inversion?
 
Rob
Do you mean truth tables?
Oh, de morgan's?
 
mr5
Yes. De morgan's
bool IsComplete => !(
            string.IsNullOrEmpty(HouseNumber) &&
            string.IsNullOrEmpty(Street) &&
            string.IsNullOrEmpty(PostalCode) &&
            string.IsNullOrEmpty(City));
My brain is still lagging right now.
 
3:16 AM
how do you know Task.Result is blocking?
 
Rob
Change the ands to ors
 
mr5
Is the above expression met the name?
I was advised to use: ! a || ! b || ! c || ! d
@ChristianMatthew don't use Task.Result
 
Rob
That will validate if any are not empty
You need to do !a && !b && !c && !d
Or !(a || b || c || d)
 
i see that but why is it blocking how did you know that
 
Rob
Because you're not awaiting to get the result
 
3:18 AM
ahhhh
 
mr5
It would run on the same SynchronizationContext, if ever that context is MainThread, you'll notice.
 
i see what you're saying
 
Rob
Or another possibility... new [] { houseNumber, street, postalCode, city }.All(s => !string.IsNullOrEmpty(s))
 
mr5
@Rob nope. That's overengineered.
 
Rob
Is it?
I'd disagree with that
It's easier to read, and it's also less likely to contain a typo
 
mr5
3:19 AM
well, I hate creating new type
 
Rob
You're not making a new type
You're making an array with the values
 
so essentially Result is waiting/blocking until it is finished separately?
 
Rob
Yes, it blocks the thread waiting for the result of the task
Which also means you can cause deadlocks
 
mr5
@Rob yes you're correct.
@Rob .All enumerates them all right?
 
Rob
Nope. It'll stop when it finds a false result
 
mr5
3:21 AM
I think it should be .Any?
 
i learned 1 important lesson here. Asynchronous programming is not the same as concurrent programming (concurrency).
 
Rob
You can use any. But you need to invert the result, and the expression would b e string.IsNullOrEmpty(s)
 
mr5
I suppose, if any of these are empty would still be a correct English statement?
 
Rob
That is assuming you want isCompleted to be true when all fields have a value
Yes. But then you're not representing, isCompleted, you're representing isIncomplete
 
mr5
Well, I'd go for the most closest thing to English language.
 
Rob
3:23 AM
@ChristianMatthew Async is a type of concurrency
It's different from parallelism
 
well in this context isn't concurrency different from the asynchrony
 
mr5
> true if every element of the source sequence passes the test in the specified predicate, or if the sequence is empty; otherwise, false.
 
meaning the other code was asynchronous but it was concurrent
 
Rob
Not necessarily... each Delay is timed concurrently
 
mr5
3:25 AM
"if every element"
which means, it will iterate every element?
 
Rob
No
It can know for sure not every element is true, if it finds even one that isn't
 
the reason why i knew something was wrong was because instead of taking 4 seconds it was taking the additive amount of time which was 10
the limiter was 4 seconds
The composition of an asynchronous operation followed by synchronous work is an asynchronous operation. Stated another way, if any portion of an operation is asynchronous, the entire operation is asynchronous.
 
Rob
Pretty much, yep
 
var reqiuredField = new[]{"address","zipcode","state"};
var emptyField = reqiuredField.FirstOrDefault(x=>string.IsNullOrEmpty(data[x]));
Log.Error("A required field was empty: "+emptyField);
 
Rob
Which is why async needs to go all the way up, unless you end up blocking on a task
 
3:30 AM
from what i see they are saying everything you do needs to be async
 
Rob
@nyconing That'll always log an error. It'll also always be an empty string/null in emptyField, so the message won't betoo useful
 
that's it just better to be asynchronous all the way around
 
Rob
Uh, it depends really
You shouldn't make a method async unless it needs to await something
 
var reqiuredField = new[]{"address","zipcode","state"};
var emptyField = reqiuredField.FirstOrDefault(x=>string.IsNullOrEmpty(data[x]));
if (emptyField !=null) Log.Error("A required field was empty: "+emptyField);
 
they argue differently. they say incoming calls and requests are better served when you are non-blocking...
 
Rob
3:32 AM
That won't log an error if the field is null :P. But even for empty string values, the log error message doesn't need to include +emptyField because we've just proven that variable has no information in it
 
even if it is in a callback scenario which is pretty much was my inital iteration was
 
Rob
Well, that's for a web server
But you can still have it async. But methods don't always need to be async
 
hmmmm isn't everything the web
 
Rob
If you had a method to concatenate a string, that doesn't need to be async
Async methods could use it, but it itself isn't async
 
no they're not saying everything inside of an async method call needs to be awaited. some code in those blocks can be synchronous but for main methods in general
 
Rob
3:34 AM
@nyconing Whoops, no, I misread it. That should work
If you're not awaiting anything in your code, there's no benefit to using async
 
the reason why I wonder is that when i read most code in the asp.net core world it is Task everywhere
 
Rob
Even if you marked it async, unless you await something, it does nothing except generate a bunch of overhead
 
hmmm they're saying yes that an incoming call won't be blocked
so that's a good thing
 
Rob
Depends what you're doing
If you had an endpoint that took a number, and returned the square
There's no need for it to be async
If you had an endpoint that read something from disk, then yes, it might be useful to use async
 
but what if another operation needs my thread
or needs to get going
it can't if i am blocked
 
Rob
3:36 AM
It doesn't matter. The only point at which the thread may be re-used is when the code hits an await
Otherwise, it's still executing synchronously, await keyword or not
 
not for TAP
that is always async
whether awaiting or not
 
Rob
That's different from what people are saying
 
here i'll show you
 
Rob
When you have proper async support, you're less likely to be starved of threads that can be used to accept connections
But if all those methods are marked async, and none of them await anything, there is no benefit at all
 
Initiating an asynchronous operation
An asynchronous method that is based on TAP can do a small amount of work synchronously, such as validating arguments and initiating the asynchronous operation, before it returns the resulting task. Synchronous work should be kept to the minimum so the asynchronous method can return quickly. Reasons for a quick return include the following:

Asynchronous methods may be invoked from user interface (UI) threads, and any long-running synchronous work could harm the responsiveness of the application.
 
Rob
3:40 AM
> Synchronous work should be kept to the minimum so the asynchronous method can return quickly
And if you never await anything, all your work is synchronous
 
no it's asynchronous
with synchronous methods
but it's still asynchronous
 
Rob
That's not correct
 
The composition of an asynchronous operation followed by synchronous work is an asynchronous operation. Stated another way, if any portion of an operation is asynchronous, the entire operation is asynchronous.
 
Rob
Yes. And if you do not use await, there is no portion of it which is asynchronous
 
Target environment
When you implement a TAP method, you can determine where asynchronous execution occurs. You may choose to execute the workload on the thread pool, implement it by using asynchronous I/O (without being bound to a thread for the majority of the operation’s execution), run it on a specific thread (such as the UI thread), or use any number of potential contexts. A TAP method may even have nothing to execute, and may just return a Task that represents the occurrence of a condition elsewhere in the system (for example, a task that represents data arriving at a queued data struc
i think they're basing asynchronous on non-blocking
 
Rob
3:43 AM
static async Task Main(string[] args)
{
	var task = DoSomething();
	Console.WriteLine("This should fire immediately!");

	await task;
}


static async Task DoSomething() {
	for (var i = 0; i < int.MaxValue; i++) {
		//
	}
}
> Console.WriteLine("This should fire immediately!");
 
so even if you're not awaiting anything you're still in an asynchronous event
 
Rob
Will not execute until that loop is finished. Even though the method is async
You've blocked the thread with work
 
hmmm i kind of agree with that
 
Rob
Again.. I know you don't believe me, but marking a method async doesn't do anything except generate some boilerplate code
It's when you use await that things become interesting
 
lol i believe you
 
Rob
3:46 AM
The task created by DoSomething() is only created when it awaits
Or when it returns
 
but i think they're trying to say that if something else comes in it won't be blocked. in the await scenario it is it is pausing and waiting for that to be finished and then continuing on
 
Rob
In this case, it'll return after running the entire loop. The resulting task is an empty task
It will be blocked if you write something like the above
If you never await, there's no difference between async and not
 
this is what i am readin
reading...
lol when I say they
so they're saying Task should return an awaitable type
that's why I did the Task.FromResult() method
 
posted on June 13, 2019 by Scott Hanselman

I've always been fascinated by making apps as small as possible, especially in the .NET space. No need to ship any files - or methods - that you don't need, right? I've blogged about optimizations you can make in your Dockerfiles to make your .NET containerized apps small, as well as using the ILLInk.Tasks linker from Mono to "tree trim" your apps to be as small as they can be. Work is on goin

 
Rob
Using Task.FromResult() is only useful if you need to return a task elsewhere in your method as well
It doesn't make it async
In fact, it's just synchronous code wrapped in a task
 
mr5
4:09 AM
Is town can be considered as street?
 
Rob
No
Not anywhere I've ever seen
 
mr5
how about city?
 
Rob
Nope
The street is really just the street..
 
If there is only one street in the small city?
 
mr5
I mean town
Can it be considered as city?
 
Rob
4:15 AM
In practice, yeah
Many forms would even specifically have a field named "town/city"
 
mr5
Hmm. I think I need to refactor my copied address parser
How about house number. Does it come in a form of numbers and letters combination?
 
4:36 AM
yes
 
mr5
4:47 AM
Are you sure?
Is it true in any EU countries?
 
@Rob just to ask
what is the point of having a call to another method as a parameter doing
is this considered a closure
 
Rob
Not sure what you mean
 
here's the refactored code
static async Task Main(string[] args)
{
	Coffee cup = PourCoffeeAsync(100);
	Console.Write("coffee is ready\r\n");
	var eggTask = FryEggsAsync(3000);
	var baconTask = FryBaconAsync(5000);
	var toastTask = maketoastWithButterAndJamAsync(3000);

	Egg eggs = await eggTask;
	Console.Write("eggs are ready\r\n");
	Bacon bacon = await baconTask;
	Console.Write("bacon is ready\r\n");
	Toast toast = await toastTask;
	Console.Write("toast is ready\r\n");
	Juice oj = PourOjAsync(100);
	Console.Write("oj is ready\r\n");
why do i need to have the submethods i.e. applybutter call the main method... what is the point of that
 
Rob
Still not clear on what you mean
It's not calling the main method
 
so a param is not calling plaintoast?
 
Rob
4:51 AM
It's the same as any other method. It's providing the toast to be buttered
plainToast is the result of the task. It's an object
 
so they way I would think of it .. if I have a method and a parameter is another function I would expect that function to be executed no?
 
Rob
It's not a function
It's an object
 
yes
ok what is doing with that object
 
Rob
In your implementation, nothing
 
lol
just checking
but doesn't it technically instantiate it when it is called like that
 
Rob
4:54 AM
Instantiate what?
 
maybe I am overthinking it
what could it do
 Toast toast = ToastBread(2);
    ApplyButter(toast);
    ApplyJam(toast);
what is the purpose of doing something like that
 
Rob
ApplyButter and ApplyJam need to do something to a toast object
 
well the object can only hold properties and values right
 
Rob
And methods
 
and methods
 
Rob
4:57 AM
But.. examples like these are very rarely enlightening
 
so you're saying in ApplyButter I could then access the toasts values
 
Rob
If instead you had something like
var line = ReadNextLine(); Print(line);
That's something more useful
 
which would be print ReadNetLine();
 
5:45 AM
how do you make a conditional parameter
 
5:56 AM
@ChristianMatthew Maybe with out
 

« first day (3166 days earlier)      last day (1776 days later) »