WEBVTT
00:00:00.000 --> 00:00:01.790
>> In this episode
of the On.Net show,
00:00:01.790 --> 00:00:03.630
will have Phillip Carter
coming back on to
00:00:03.630 --> 00:00:05.640
talk to us about some of
the new tooling enhancements
00:00:05.640 --> 00:00:10.490
for F# developers inside of
Visual Studio 2017, 15.8.
00:00:17.930 --> 00:00:20.760
Welcome to another episode
of On.Net show,
00:00:20.760 --> 00:00:22.500
my name is Cecil
Phillip and with me
00:00:22.500 --> 00:00:24.500
I have Phillip back on
the show. How is it going man?
00:00:24.500 --> 00:00:25.550
>> Right. Pretty good. Yourself?
00:00:25.550 --> 00:00:26.090
>> Pretty good.
00:00:26.090 --> 00:00:27.750
>> So, what you hear to
talk to us about today?
00:00:27.750 --> 00:00:30.300
>> So, I'm here to
talk about F# tooling
00:00:30.300 --> 00:00:33.245
in Visual Studio
specifically VS 2017.
00:00:33.245 --> 00:00:34.140
>> Vs '17.
00:00:34.140 --> 00:00:34.300
>> Yeah.
00:00:34.300 --> 00:00:36.705
>> So we're talking
about Visual Studio, VS.
00:00:36.705 --> 00:00:37.250
>> 2017.
00:00:37.250 --> 00:00:40.960
>> Sorry. Visual Studio
2017, 15.8, right?
00:00:40.960 --> 00:00:42.230
>> Yeah, 15.8.
00:00:42.230 --> 00:00:46.495
It should be 15.9 fairly in
soon in the future, but.
00:00:46.495 --> 00:00:46.870
>> Okay.
00:00:46.870 --> 00:00:47.870
>> We just have some bug fixes
00:00:47.870 --> 00:00:49.070
going in that one
because that's kind of
00:00:49.070 --> 00:00:51.575
recognize stability release.
That sort of stuff, but.
00:00:51.575 --> 00:00:52.075
>> Okay.
00:00:52.075 --> 00:00:53.970
>> Kind of the one of the
things I wanted to do is,
00:00:53.970 --> 00:00:57.375
like we shipped
some new cool stuff in 15.8.
00:00:57.375 --> 00:00:57.900
>> Yeah.
00:00:57.900 --> 00:00:59.960
>> But there's been
a whole lot of
00:00:59.960 --> 00:01:01.990
F# tools that are shipped
in Visual Studio,
00:01:01.990 --> 00:01:06.350
all the way in the Visual Studio
2017 lifetime. So.
00:01:06.350 --> 00:01:06.780
>> Okay.
00:01:06.780 --> 00:01:08.670
>> I think it probably
be a good idea to just
00:01:08.670 --> 00:01:10.450
kind of go through
like all the stuff,
00:01:10.450 --> 00:01:12.350
because there's
a huge difference between
00:01:12.350 --> 00:01:14.659
this one and Visual Studio 2015,
00:01:14.659 --> 00:01:17.445
especially in what's installed
in a box by default.
00:01:17.445 --> 00:01:18.590
>> Okay. Pretty
good. So, why don't
00:01:18.590 --> 00:01:19.730
we start off with
just showing people
00:01:19.730 --> 00:01:22.280
how we could even get
these updates. Installed.
00:01:22.280 --> 00:01:22.630
>> Yeah.
00:01:22.630 --> 00:01:24.250
>> How can I get the
F# tooling support?
00:01:24.250 --> 00:01:26.805
>> Absolutely. So first,
00:01:26.805 --> 00:01:27.890
it's probably good idea to go
00:01:27.890 --> 00:01:29.300
to the Visual Studio
website and there's
00:01:29.300 --> 00:01:31.050
a really nice big
download button there.
00:01:31.050 --> 00:01:32.270
So you can click that
and then you will
00:01:32.270 --> 00:01:34.060
download the Visual
Studio Installer.
00:01:34.060 --> 00:01:34.820
>> Okay.
00:01:34.820 --> 00:01:38.415
>> The VS Installer.
Once you select stuff,
00:01:38.415 --> 00:01:40.130
it will pop up something
that looks like this,
00:01:40.130 --> 00:01:41.340
where you've got these workloads.
00:01:41.340 --> 00:01:41.580
>> Right.
00:01:41.580 --> 00:01:43.440
>> So, there's
a whole bunch of stuff.
00:01:43.440 --> 00:01:43.695
>> Right.
00:01:43.695 --> 00:01:45.760
>> Try not to get too caught up
00:01:45.760 --> 00:01:47.690
and let every single
one means here.
00:01:47.690 --> 00:01:50.885
The two important ones
are.NET desktop
00:01:50.885 --> 00:01:54.170
development and ASP.NET
and web development.
00:01:54.170 --> 00:01:55.580
This will give you
a whole bunch of tools
00:01:55.580 --> 00:01:57.575
including everything
that you need for F#.
00:01:57.575 --> 00:01:59.170
So, the.NET desktop development.
00:01:59.170 --> 00:02:01.270
There is also an additional
thing you may want to select,
00:02:01.270 --> 00:02:02.990
if you have older
F# style projects
00:02:02.990 --> 00:02:05.210
that are not targeting.NET Core.
00:02:05.210 --> 00:02:05.860
>> Yes.
00:02:05.860 --> 00:02:08.320
>> There's a thing here
called an Individual
00:02:08.320 --> 00:02:11.550
Component as it's called F#
desktop language support.
00:02:11.550 --> 00:02:14.180
All this does is bring along
founded project templates
00:02:14.180 --> 00:02:16.000
that create older style projects,
00:02:16.000 --> 00:02:17.720
they're like the really big ones
00:02:17.720 --> 00:02:19.695
but like there's a lot of
people who still use those.
00:02:19.695 --> 00:02:21.445
So you can select that,
that'll bring it on.
00:02:21.445 --> 00:02:23.000
So I want to do is I
want to make sure that I
00:02:23.000 --> 00:02:24.910
select that desktop
development option.
00:02:24.910 --> 00:02:25.160
>> Yeah.
00:02:25.160 --> 00:02:26.840
>> Then, on the right
side, I can see
00:02:26.840 --> 00:02:28.190
like underneath
the optional sections
00:02:28.190 --> 00:02:28.940
is what we're looking at, right?
00:02:28.940 --> 00:02:29.100
>> Yeah.
00:02:29.100 --> 00:02:29.750
>> Then we can select those.
00:02:29.750 --> 00:02:30.080
>> Yeah.
00:02:30.080 --> 00:02:34.660
>> So, between this and the
ASP.Net and web workload,
00:02:34.660 --> 00:02:37.185
you will also get.NET Core
installed in your machine.
00:02:37.185 --> 00:02:37.530
>> Okay.
00:02:37.530 --> 00:02:38.700
>> The latest good one that came
00:02:38.700 --> 00:02:42.320
with the Visual Studio there,
nd that will also install
00:02:42.320 --> 00:02:44.345
some additional templates
for creating .NET
00:02:44.345 --> 00:02:47.955
Core style projects,.NET
standard projects,
00:02:47.955 --> 00:02:49.965
unit tests projects
that use.NET Core and
00:02:49.965 --> 00:02:52.730
ASP.NET Core Style projects
00:02:52.730 --> 00:02:54.280
for building web APIs
and things like that.
00:02:54.280 --> 00:02:54.800
>> Got you.
00:02:54.800 --> 00:02:56.600
>> So once you have
that all installed.
00:02:56.600 --> 00:02:58.770
Once you go to "File",
"New Projects",
00:02:58.770 --> 00:03:01.835
you should be able to
see quite a few options
00:03:01.835 --> 00:03:03.260
under F# there.
00:03:03.260 --> 00:03:05.440
So like I've got under
.NET Core thing,
00:03:05.440 --> 00:03:07.325
I've got a few options there.
00:03:07.325 --> 00:03:09.110
I can create some unit
tests projects if I like.
00:03:09.110 --> 00:03:11.210
I can create a web app if I like.
00:03:11.210 --> 00:03:12.490
I'm actually not going
to do that because
00:03:12.490 --> 00:03:14.940
that would break
my current solution.
00:03:15.050 --> 00:03:17.400
Well, I'll close it not break it.
00:03:17.400 --> 00:03:19.410
Sorry. But once you're there,
00:03:19.410 --> 00:03:20.440
then you're sort of set.
00:03:20.440 --> 00:03:21.710
You can do pretty much
anything you
00:03:21.710 --> 00:03:23.470
like with F# inside
of Visual Studio.
00:03:23.470 --> 00:03:24.540
>> Okay. Cool. So
sounds pretty good.
00:03:24.540 --> 00:03:26.095
So let's take a look at
some of this tooling.
00:03:26.095 --> 00:03:26.730
>> Yeah.
00:03:26.730 --> 00:03:27.100
>> We got to know.
00:03:27.100 --> 00:03:27.200
>> Yeah, absolutely.
00:03:27.200 --> 00:03:28.715
>> So what I did is,
00:03:28.715 --> 00:03:30.740
I went and I went
ahead and I cloned
00:03:30.740 --> 00:03:32.840
the FSharp.formatting project,
00:03:32.840 --> 00:03:34.640
which is a big community
project out there
00:03:34.640 --> 00:03:36.100
that lets you do a whole bunch
of different stuff.
00:03:36.100 --> 00:03:39.890
It's sort of, if you have
a library and you want
00:03:39.890 --> 00:03:41.960
to have really descriptive
comments that sort
00:03:41.960 --> 00:03:44.130
of explain how you
should use this library.
00:03:44.130 --> 00:03:44.270
>> Yeah.
00:03:44.270 --> 00:03:45.470
>> You can put that
in source code
00:03:45.470 --> 00:03:46.490
and you can actually embed
00:03:46.490 --> 00:03:49.045
mark down inside of
comments and stuff.
00:03:49.045 --> 00:03:50.930
What this thing will do is,
this will go and actually
00:03:50.930 --> 00:03:53.120
parse that as Markdown and
then will actually meet.
00:03:53.120 --> 00:03:54.420
Markdown files, the HTML
00:03:54.420 --> 00:03:56.540
files, all sorts of
different stuff.
00:03:56.540 --> 00:03:58.470
It supports a wide variety
of formatting.
00:03:58.470 --> 00:04:00.680
So when you actually use it,
00:04:00.680 --> 00:04:05.190
you can produce websites that
looks kind of like this,
00:04:05.360 --> 00:04:07.450
and what's kind of neat,
00:04:07.450 --> 00:04:09.035
is it's got some cool
code samples.
00:04:09.035 --> 00:04:10.420
If you hover over,
you actually get
00:04:10.420 --> 00:04:12.610
a tool tip inside the browser,
which is pretty neat.
00:04:12.610 --> 00:04:13.665
>> That's pretty impressive.
00:04:13.665 --> 00:04:15.230
>> This is a really,
really cool project there.
00:04:15.230 --> 00:04:16.250
I recommend that people try it
00:04:16.250 --> 00:04:19.030
out if they're interested
in this sort of thing.
00:04:19.030 --> 00:04:21.015
So I have the full solution open.
00:04:21.015 --> 00:04:22.525
You notice on the,
00:04:22.525 --> 00:04:23.755
I move this over onto
00:04:23.755 --> 00:04:25.875
the left-hand side because I
usually prefer it that way.
00:04:25.875 --> 00:04:28.715
These are all new style projects.
00:04:28.715 --> 00:04:31.225
So we have full
support for these.
00:04:31.225 --> 00:04:34.210
So you can edit it and
see what's in there.
00:04:34.210 --> 00:04:37.590
So this is much nicer
project file format.
00:04:37.590 --> 00:04:40.540
The main difference between
this and C# is that, with F#,
00:04:40.540 --> 00:04:43.630
you specify the files
explicitly rather
00:04:43.630 --> 00:04:46.695
than use file globbing
because file ordering is-.
00:04:46.695 --> 00:04:47.330
>> Important.
00:04:47.330 --> 00:04:48.705
>> Yeah. It's important
for the compiler.
00:04:48.705 --> 00:04:49.795
>> Got it.
00:04:49.795 --> 00:04:52.200
>> But yeah. You got
all these and so,
00:04:52.200 --> 00:04:53.910
we're inside the
Markdown parser here.
00:04:53.910 --> 00:04:55.170
It's kind of this big file
00:04:55.170 --> 00:04:57.250
and we scroll
all the way to the top.
00:04:57.250 --> 00:05:00.860
Whole lot going on here,
but I think I'm just
00:05:00.860 --> 00:05:04.410
going to go through the list
here as we go through this.
00:05:04.410 --> 00:05:05.475
>> Yeah. Let's do it.
00:05:05.475 --> 00:05:08.655
>> Through the style
here. So in VS 2015,
00:05:08.655 --> 00:05:10.205
there was sort
of minimal colorization.
00:05:10.205 --> 00:05:12.520
Like you got keywords and stuff,
00:05:12.520 --> 00:05:14.745
but that everything else was
just kind of like black text.
00:05:14.745 --> 00:05:14.970
>> Sure.
00:05:14.970 --> 00:05:16.230
>> Which is fine.
00:05:16.230 --> 00:05:17.715
There some people who
actually prefer that.
00:05:17.715 --> 00:05:20.030
You can actually set that
setting to be that way,
00:05:20.030 --> 00:05:21.740
but a lot of people
especially those
00:05:21.740 --> 00:05:23.500
who had been doing
C# style programming,
00:05:23.500 --> 00:05:25.879
have gotten used to
semantic colorization.
00:05:25.879 --> 00:05:27.800
Right? So, like you know
types being able to
00:05:27.800 --> 00:05:29.850
be colorized as teal for example.
00:05:29.850 --> 00:05:29.990
>> Sure.
00:05:29.990 --> 00:05:31.360
>> Or you could you
could set it to be pink.
00:05:31.360 --> 00:05:32.420
So that's be anything like that,
00:05:32.420 --> 00:05:34.135
the differentiate by default.
00:05:34.135 --> 00:05:35.870
So we're doing that as well.
00:05:35.870 --> 00:05:37.990
You'll notice that that's
also in the tool tip.
00:05:37.990 --> 00:05:40.220
So we have like icon in there
00:05:40.220 --> 00:05:41.990
that sort of represents
like I guess
00:05:41.990 --> 00:05:44.135
that's what module looks
like for the icon.
00:05:44.135 --> 00:05:45.680
But we sort of bring
00:05:45.680 --> 00:05:47.360
that colorization into
the tool tips as well,
00:05:47.360 --> 00:05:49.690
which is new because in VS 2015
00:05:49.690 --> 00:05:51.750
these would all
just be white text.
00:05:51.750 --> 00:05:52.215
>> Right.
00:05:52.215 --> 00:05:55.120
>> Which, it can be a little
hard to read a really,
00:05:55.120 --> 00:05:57.110
really big thing of
white text and so that's
00:05:57.110 --> 00:05:59.850
why we do that.
00:05:59.850 --> 00:06:02.575
So. Yeah. We've got this
colorized tool tips but then,
00:06:02.575 --> 00:06:03.910
speaking of more colors there's
00:06:03.910 --> 00:06:05.830
some other fun stuff
that you can do.
00:06:05.830 --> 00:06:09.790
So let me just pick
a random function in here.
00:06:09.790 --> 00:06:13.120
Somewhere in here. There's
a whole lot to cover.
00:06:13.120 --> 00:06:16.930
Okay. I'll just go inside
here and I'm going to
00:06:16.930 --> 00:06:20.200
do something that
is nonstandard F#.
00:06:20.200 --> 00:06:21.735
I'll create a mutable value.
00:06:21.735 --> 00:06:22.130
>> Okay.
00:06:22.130 --> 00:06:29.435
>> Okay. So we got. Let mutable
nonstandard value is 12.
00:06:29.435 --> 00:06:29.880
>> Okay.
00:06:29.880 --> 00:06:30.850
>> So you notice this got
00:06:30.850 --> 00:06:32.565
colorized a little bit
differently.
00:06:32.565 --> 00:06:34.900
It's sort of this
yellow oranges color.
00:06:34.900 --> 00:06:37.395
It's actually a bit more
prominent in the dark theme.
00:06:37.395 --> 00:06:39.870
So but, it'll show up in
your different theming.
00:06:39.870 --> 00:06:41.060
So in this case,
00:06:41.060 --> 00:06:42.810
I'm just creating a mutable
value and I'm setting it,
00:06:42.810 --> 00:06:44.360
and that's not terrible F#,
00:06:44.360 --> 00:06:46.730
but F# is immutable by default.
00:06:46.730 --> 00:06:47.015
>> Right.
00:06:47.015 --> 00:06:50.450
>> So it's oftentimes really
helpful to see like at
00:06:50.450 --> 00:06:52.490
a glance what things are
mutable versus what things
00:06:52.490 --> 00:06:54.635
are not mutable based
off of colorization.
00:06:54.635 --> 00:06:55.270
>> Sure.
00:06:55.270 --> 00:06:57.320
>> So as you go
00:06:57.320 --> 00:06:59.270
through and actually inspect
each individual value,
00:06:59.270 --> 00:07:00.980
you can certainly find
that out yourself
00:07:00.980 --> 00:07:02.900
but it's really nice
as you're just kind of
00:07:02.900 --> 00:07:04.825
scanning code to see that.
00:07:04.825 --> 00:07:06.640
>> Right. So I'm looking
at the code right now.
00:07:06.640 --> 00:07:09.015
So we're looking at line 332.
00:07:09.015 --> 00:07:09.315
>> Yeah.
00:07:09.315 --> 00:07:10.580
>> Right. So it has
a different color
00:07:10.580 --> 00:07:12.200
but if we look at 334.
00:07:12.200 --> 00:07:12.505
>> Yeah.
00:07:12.505 --> 00:07:14.500
>> That one is
a non-mutable value.
00:07:14.500 --> 00:07:14.650
>> Yeah.
00:07:14.650 --> 00:07:15.550
>> It has a different
color, right?
00:07:15.550 --> 00:07:15.760
>> Yeah.
00:07:15.760 --> 00:07:16.520
>> So that's how we can help
00:07:16.520 --> 00:07:17.580
differentiate between the two.
00:07:17.580 --> 00:07:18.285
>> Exactly.
00:07:18.285 --> 00:07:18.580
>> Yeah.
00:07:18.580 --> 00:07:18.700
>> Yeah.
00:07:18.700 --> 00:07:20.720
So no hash is immutable and
that's why it's not colored.
00:07:20.720 --> 00:07:22.725
If I were to mutate this.
00:07:22.725 --> 00:07:24.850
Well, if I were to say
that it's mutable,
00:07:24.850 --> 00:07:26.455
then it immediately
changes color.
00:07:26.455 --> 00:07:26.660
>> Sure.
00:07:26.660 --> 00:07:28.760
>> Now, that doesn't
necessarily mean that it
00:07:28.760 --> 00:07:29.960
is being changed but it means
00:07:29.960 --> 00:07:31.130
that it's possible
of being changed.
00:07:31.130 --> 00:07:31.610
>> It's true.
00:07:31.610 --> 00:07:33.475
>> Sorry. Possibly
it will change.
00:07:33.475 --> 00:07:36.355
So something you may
have also noticed.
00:07:36.355 --> 00:07:37.690
This left-hand side here is,
00:07:37.690 --> 00:07:40.380
there's all these like
these dotted lines going on.
00:07:40.380 --> 00:07:41.790
There's these vertical
dotted lines.
00:07:41.790 --> 00:07:43.729
These are known as
structured guidelines.
00:07:43.729 --> 00:07:47.045
This is a new feature that
shipped in VS 2017 and
00:07:47.045 --> 00:07:50.560
it's all based off of the
actual structure of the code.
00:07:50.560 --> 00:07:53.750
So like I can use
outlining in this case
00:07:53.750 --> 00:07:56.175
and sort of collapse things,
and I can collapse things.
00:07:56.175 --> 00:07:59.410
This scope is inside of
this scope that we see here.
00:07:59.410 --> 00:08:00.775
So this function,
00:08:00.775 --> 00:08:02.750
I can collapse the whole thing or
00:08:02.750 --> 00:08:05.650
I can just choose to collapse
this thing altogether.
00:08:05.650 --> 00:08:07.610
Or if I'm the kind of person
00:08:07.610 --> 00:08:08.870
who doesn't like
any of this stuff,
00:08:08.870 --> 00:08:10.335
I can actually just
go to settings
00:08:10.335 --> 00:08:12.950
and turn it all off and then
I won't get any ability
00:08:12.950 --> 00:08:14.900
to code folder and
things like that,
00:08:14.900 --> 00:08:17.210
but it's all configurable
which is pretty cool. Sure.
00:08:17.210 --> 00:08:19.140
>> Is this also two because F#
00:08:19.140 --> 00:08:21.565
has like white space significant.
00:08:21.565 --> 00:08:24.050
>> Yeah. So this can
actually be pretty helpful
00:08:24.050 --> 00:08:26.990
because F# is white space
significant and so as you said.
00:08:26.990 --> 00:08:31.480
So it's one of those things
where you can usually
00:08:31.480 --> 00:08:33.200
sort of notice if you look
at something really hard,
00:08:33.200 --> 00:08:35.630
but if you're just doing
a quick glance at something,
00:08:35.630 --> 00:08:37.730
seeing this vertical line
sort of go all the way
00:08:37.730 --> 00:08:38.960
and then seeing
something else and
00:08:38.960 --> 00:08:41.060
that's to the right of
that vertical line,
00:08:41.060 --> 00:08:43.040
that can very easily
help you like,
00:08:43.040 --> 00:08:44.615
"Oh, yeah. This is in
a different scope.".
00:08:44.615 --> 00:08:45.130
>> Right. Got it.
00:08:45.130 --> 00:08:48.275
>> Yeah. Then we also have.
00:08:48.275 --> 00:08:49.410
Speaking of colorization,
00:08:49.410 --> 00:08:51.070
we also have format
string colorization.
00:08:51.070 --> 00:08:56.860
So sa,y I wanted to printout
this value for some reason.
00:08:56.860 --> 00:09:00.190
Value is, there we go.
00:09:00.190 --> 00:09:02.430
I'll go nonstandard value.
00:09:02.430 --> 00:09:04.950
So you'll notice that
the actual color of
00:09:04.950 --> 00:09:08.000
this format specifier inside
of the string is different.
00:09:08.000 --> 00:09:08.615
>> Right.
00:09:08.615 --> 00:09:11.230
>> That's a way for you to
very quickly differentiate,
00:09:11.230 --> 00:09:13.825
like where in the format string
something is going to be.
00:09:13.825 --> 00:09:14.375
>> Right.
00:09:14.375 --> 00:09:16.140
>> So that's pretty neat.
00:09:16.140 --> 00:09:16.625
>> Nice.
00:09:16.625 --> 00:09:19.330
>> Yeah. Then so we
have a few other things
00:09:19.330 --> 00:09:19.930
that are kind of cool,
00:09:19.930 --> 00:09:21.290
which you've probably
already noticed.
00:09:21.290 --> 00:09:24.080
If I click on this header symbol,
00:09:24.080 --> 00:09:25.750
you'll notice that it
kind of highlights
00:09:25.750 --> 00:09:27.325
the other things inside of there.
00:09:27.325 --> 00:09:29.120
That's known as
semantic highlighting.
00:09:29.120 --> 00:09:30.740
Again, one of those things
that's not really
00:09:30.740 --> 00:09:32.530
like this super big deal,
00:09:32.530 --> 00:09:34.070
but as you sort of click things,
00:09:34.070 --> 00:09:35.360
you can see kind of
other glance where
00:09:35.360 --> 00:09:37.300
it's being used. Go there.
00:09:37.300 --> 00:09:39.470
It's one of those things
that over the course of
00:09:39.470 --> 00:09:40.865
a long day where you're just
00:09:40.865 --> 00:09:42.080
looking at all sorts
of little code,
00:09:42.080 --> 00:09:43.220
it really helps to just click
00:09:43.220 --> 00:09:44.590
something sort of see
where it's being used,
00:09:44.590 --> 00:09:46.220
go from there and not really
have to think too hard
00:09:46.220 --> 00:09:48.645
about where the thing
is actually being used.
00:09:48.645 --> 00:09:50.435
>> Sure. I'm kind
of wondering too.
00:09:50.435 --> 00:09:50.650
>> Yeah.
00:09:50.650 --> 00:09:52.630
>> As I select that particular.
00:09:52.630 --> 00:09:54.175
>> That particular variable.
00:09:54.175 --> 00:09:56.200
>> To have the ability
to like for instance,
00:09:56.200 --> 00:09:57.740
if I just start editing,
00:09:57.740 --> 00:09:59.870
will it just start renaming
all of the other ones.
00:09:59.870 --> 00:10:01.865
Like if I wanted to refactor?
00:10:01.865 --> 00:10:03.995
>> Yeah. If I could refactor,
so if you want to refactor,
00:10:03.995 --> 00:10:06.775
you can actually go ahead
and try to rename it.
00:10:06.775 --> 00:10:09.310
So in this case, this
is inline rename.
00:10:09.310 --> 00:10:10.970
You notice all these
things are green.
00:10:10.970 --> 00:10:11.550
>> Got it.
00:10:11.550 --> 00:10:15.250
>> So I can go, I can
call it Cecil's header.
00:10:15.250 --> 00:10:15.715
>> Sure.
00:10:15.715 --> 00:10:16.760
>> It will show up
in there and then
00:10:16.760 --> 00:10:17.920
I can apply those changes.
00:10:17.920 --> 00:10:19.270
This works across the solution.
00:10:19.270 --> 00:10:20.985
So it's not just limited
to a single file.
00:10:20.985 --> 00:10:22.090
>> Oh no.
00:10:22.090 --> 00:10:26.770
>> Right. Similarly, if I
wanted to find references,
00:10:26.770 --> 00:10:28.905
I could just do "Shift F12"
00:10:28.905 --> 00:10:32.570
here and then it'll bring
it up in this really
00:10:32.570 --> 00:10:34.220
collapsed window
that I have here,
00:10:34.220 --> 00:10:36.200
but then you can see
this is the new find
00:10:36.200 --> 00:10:39.015
references window that C# DB use,
00:10:39.015 --> 00:10:42.555
and you can sort of explore
things like that as well.
00:10:42.555 --> 00:10:42.905
>> Nice.
00:10:42.905 --> 00:10:45.830
>> Which is pretty
cool. Another one
00:10:45.830 --> 00:10:47.510
that we have is
braced completion.
00:10:47.510 --> 00:10:48.800
Which is again, one
of those things
00:10:48.800 --> 00:10:51.920
that's not particularly
incredible thing
00:10:51.920 --> 00:10:54.325
but it's still kind of nice.
00:10:54.325 --> 00:10:57.040
If I wanted to define like
a little inline function there,
00:10:57.040 --> 00:11:01.860
I could say that that's equal
to or no I won't do that.
00:11:02.060 --> 00:11:05.240
I can never think of like
what to show off with
00:11:05.240 --> 00:11:08.020
brace completion when I'm
actually on the spot.
00:11:08.020 --> 00:11:09.250
I think I know what I'll do.
00:11:09.250 --> 00:11:09.655
>> Okay.
00:11:09.655 --> 00:11:11.610
>> I'll create
a new script file here.
00:11:11.610 --> 00:11:14.140
SoI just did "Control N"
and this script files
00:11:14.140 --> 00:11:15.160
just kind of sitting somewhere.
00:11:15.160 --> 00:11:18.650
So I'll create a new empty class.
00:11:18.650 --> 00:11:21.679
It doesn't do anything important
00:11:21.679 --> 00:11:26.365
but you'll notice that
as I typed out these.
00:11:26.365 --> 00:11:29.270
That was actually not one
of the context works in,
00:11:29.270 --> 00:11:31.240
but this is a context.
It actually shows up.
00:11:31.240 --> 00:11:32.050
>> Right.
00:11:32.050 --> 00:11:36.700
>> So this is how you
do attributes in F#.
00:11:36.700 --> 00:11:37.760
They're actually two characters.
00:11:37.760 --> 00:11:40.500
So if I want to do this,
that's not natural attribute.
00:11:40.500 --> 00:11:41.940
Go like that, it'll
actually work.
00:11:41.940 --> 00:11:42.460
>> Got it.
00:11:42.460 --> 00:11:44.550
>> I can say that
that's out of open.
00:11:44.550 --> 00:11:47.120
This would actually be
an invalid application
00:11:47.120 --> 00:11:49.500
of that attribute but
I can go from there.
00:11:49.500 --> 00:11:50.555
>> Sure.
00:11:50.555 --> 00:11:53.075
>> There's some pretty
fun stuff like that?
00:11:53.075 --> 00:11:54.970
>> Just nice little quality
of life improvement
00:11:54.970 --> 00:11:57.300
that you would not be
able to have in VS 2015
00:11:57.300 --> 00:11:58.205
but you get it now.
00:11:58.205 --> 00:11:58.580
>> Right.
00:11:58.580 --> 00:11:59.700
>> I think what's really
00:11:59.700 --> 00:12:00.850
cool about a lot
of these features
00:12:00.850 --> 00:12:03.580
is as you're writing
significant amounts of code,
00:12:03.580 --> 00:12:08.090
like those little quick fixes
and those little shortcuts,
00:12:08.090 --> 00:12:10.360
really help you improve,
save you a lot of
00:12:10.360 --> 00:12:12.610
time over the course of
your development space.
00:12:12.610 --> 00:12:14.225
>> Yeah, yeah, absolutely and so
00:12:14.225 --> 00:12:15.870
you can do all sorts
of fun stuff.
00:12:15.870 --> 00:12:18.015
So say, I'll define
a new F# type here,
00:12:18.015 --> 00:12:22.090
we'll call this Person and
a Person can either be
00:12:22.090 --> 00:12:29.055
a Phillip with a name
or a Cecil with a name.
00:12:29.055 --> 00:12:32.360
So we are only two types
of people that can exist,
00:12:32.360 --> 00:12:37.820
I think here or did
I there we go know.
00:12:37.820 --> 00:12:40.955
Never type and think and
talk at the same time.
00:12:40.955 --> 00:12:42.615
>> But just follow us.
00:12:42.615 --> 00:12:45.165
>> So I have a new type,
you can see right here,
00:12:45.165 --> 00:12:46.810
it's Phillip a strings,
Cecil is a little string,
00:12:46.810 --> 00:12:49.075
it's a pretty straightforward
discriminated union.
00:12:49.075 --> 00:12:50.875
So I'll create
an instance one of those
00:12:50.875 --> 00:13:00.150
I'll go Phillip and I'll
give myself the name Phillip
00:13:00.150 --> 00:13:02.335
this nice redundant code here
00:13:02.335 --> 00:13:05.180
and we'll do that
with Cecil here.
00:13:05.180 --> 00:13:07.365
But instead, I will,
00:13:07.365 --> 00:13:10.350
let's just do that because
it's pretty common for me
00:13:10.350 --> 00:13:13.675
to mistype something like
00:13:13.675 --> 00:13:15.370
and immediately you get
00:13:15.370 --> 00:13:16.670
a compiler error which
is just kind of cool.
00:13:16.670 --> 00:13:18.785
But, a little light
bulb popped up,
00:13:18.785 --> 00:13:21.575
I go there says
replace with Cecil
00:13:21.575 --> 00:13:24.670
the actual version of it.
00:13:24.670 --> 00:13:28.489
So like, if you mistype something
and it's kind of close,
00:13:28.489 --> 00:13:30.940
will actually detect
that and will suggest
00:13:30.940 --> 00:13:33.190
something to based off of what
the compiler already knows.
00:13:33.190 --> 00:13:35.390
Because, like if I undo this,
00:13:35.390 --> 00:13:37.130
sort of up until
this point the compilers
00:13:37.130 --> 00:13:39.115
already figured out that person,
00:13:39.115 --> 00:13:41.150
there's a Cecil class in here
00:13:41.150 --> 00:13:43.485
and this looks like it's
pretty close to that.
00:13:43.485 --> 00:13:45.665
That's why it suggests
it right there.
00:13:45.665 --> 00:13:47.410
>> You said that's not
just based on the file,
00:13:47.410 --> 00:13:49.430
it's based on whatever's in
the project or in solution?
00:13:49.430 --> 00:13:50.560
>> Yeah. This is
based on whatever
00:13:50.560 --> 00:13:52.215
the compiler knows
up until this point.
00:13:52.215 --> 00:13:52.570
>> Got it.
00:13:52.570 --> 00:13:56.385
>> Yeah. Then another thing
that you may have noticed is
00:13:56.385 --> 00:14:00.960
that Cecil right here
was sort of grayed out,
00:14:00.960 --> 00:14:02.820
like it's not quite as strong of
00:14:02.820 --> 00:14:04.735
a color as Phillip because,
00:14:04.735 --> 00:14:07.330
logically I'm not actually
using it I'm using
00:14:07.330 --> 00:14:10.240
this thing called CECC.
00:14:10.240 --> 00:14:11.725
>> There's a different
version of it.
00:14:11.725 --> 00:14:14.550
>> Yeah, and then and then
I'll go out and replace it and
00:14:14.550 --> 00:14:16.140
then the color pops in
00:14:16.140 --> 00:14:17.955
for this because it's
actually being used.
00:14:17.955 --> 00:14:19.250
>> Got it.
00:14:19.710 --> 00:14:23.700
>> So say, I wanted
to do this well,
00:14:23.700 --> 00:14:29.040
I have a list of let's
say that it goes to five
00:14:29.040 --> 00:14:31.465
and then I'll have a function,
00:14:31.465 --> 00:14:37.080
well, let's just call
it squares and that's.
00:14:38.070 --> 00:14:41.250
We'll have an inline list
here; one , two, three, four,
00:14:41.250 --> 00:14:45.110
five and we'll pipe that into
00:14:45.110 --> 00:14:50.760
List.map fun x such
that x times x, cool.
00:14:50.760 --> 00:14:53.130
So you may been thinking well
00:14:53.130 --> 00:14:55.500
you've just created
a list up here,
00:14:55.500 --> 00:14:57.290
why did you just do
something in there.
00:14:57.290 --> 00:14:59.350
Well, that's just a show off
like all of these are sort of
00:14:59.350 --> 00:15:00.500
grayed out right now
because they're not
00:15:00.500 --> 00:15:01.700
actually being used by something.
00:15:01.700 --> 00:15:04.290
So in this case, list is not
being used by something so
00:15:04.290 --> 00:15:05.560
the compiler knows this and I get
00:15:05.560 --> 00:15:07.060
a light bulb suggestion
saying like.
00:15:07.060 --> 00:15:08.590
"Hey, it's not being used.
00:15:08.590 --> 00:15:10.010
Do you want to give
it an underscore
00:15:10.010 --> 00:15:11.710
as a name is sort of
like a discard?".
00:15:11.710 --> 00:15:12.445
>> Okay.
00:15:12.445 --> 00:15:14.070
>> Because sometimes,
it is valid in
00:15:14.070 --> 00:15:16.420
F# code to do something
that produces a value.
00:15:16.420 --> 00:15:17.840
We don't really care what
the value is really,
00:15:17.840 --> 00:15:19.435
you are not using it
at this point in time.
00:15:19.435 --> 00:15:21.920
So you can just, I can
just call it underscore
00:15:21.920 --> 00:15:24.360
and then I won't get the
light bulb to pop up anymore.
00:15:24.360 --> 00:15:26.865
It won't trigger an
unused value warning if
00:15:26.865 --> 00:15:29.890
I compile with unused value
as one of those things.
00:15:29.890 --> 00:15:32.480
So it's a setting that you
can set in the compiler to
00:15:32.480 --> 00:15:33.550
make sure that you always
00:15:33.550 --> 00:15:34.860
use all your values
that you defined.
00:15:34.860 --> 00:15:35.565
>> Right.
00:15:35.565 --> 00:15:39.835
>> So that's kind of need
to, another fun one.
00:15:39.835 --> 00:15:43.195
So let's define an interface,
00:15:43.195 --> 00:15:47.470
it's called INameable
and we'll give it
00:15:47.470 --> 00:15:53.905
an abstracts GetName, okay.
00:15:53.905 --> 00:15:56.050
So this interface,
00:15:56.050 --> 00:15:58.610
you can just call GetName
it'll produce a string,
00:15:58.610 --> 00:16:01.465
the string is probably
a name for that.
00:16:01.465 --> 00:16:04.680
So in F#, you can create sort of
00:16:04.680 --> 00:16:08.580
these ad hoc interface
implementations.
00:16:08.580 --> 00:16:09.810
Like you don't need
to do the ceremony of
00:16:09.810 --> 00:16:11.460
a whole class, implement
this interface,
00:16:11.460 --> 00:16:12.840
create an instance of the class,
00:16:12.840 --> 00:16:15.470
you can do this, it's really
helpful for unit testing.
00:16:15.470 --> 00:16:20.290
So, I'll create
a nameable instance
00:16:20.290 --> 00:16:23.080
and then I'm going
to use this syntax
00:16:23.080 --> 00:16:29.650
for object expressions, and
I'll go new INameable with,
00:16:29.650 --> 00:16:32.020
and all of a sudden I
get another light bulb
00:16:32.020 --> 00:16:33.530
popping up right here.
00:16:33.530 --> 00:16:36.040
Okay. It says
implement interface,
00:16:36.040 --> 00:16:37.400
so I can actually choose to have
00:16:37.400 --> 00:16:39.280
this implemented in line here,
00:16:39.280 --> 00:16:42.400
and this throws a new not
implemented exception
00:16:42.400 --> 00:16:43.660
at this point in
time but you know.
00:16:43.660 --> 00:16:45.800
>> That's just a placeholder?
00:16:45.800 --> 00:16:49.790
>> Yeah, exactly. So I'll
have it do fill up there
00:16:49.790 --> 00:16:52.305
which is kind of nice
because I'm Phillip.
00:16:52.305 --> 00:16:53.665
>> Sure.
00:16:53.665 --> 00:16:56.020
>> There we go.
So, now I was able
00:16:56.020 --> 00:16:57.800
to do a little bit
of code gen there.
00:16:57.800 --> 00:17:00.320
So then, we can just
send this off to F#
00:17:00.320 --> 00:17:06.700
Interactive and
pop this up there.
00:17:08.520 --> 00:17:11.370
So that's been sent there
I'm just going to actually
00:17:11.370 --> 00:17:14.680
invoke the name because
I forgot to do that.
00:17:15.180 --> 00:17:17.780
>> Could you do that in
F# Interactive though,
00:17:17.780 --> 00:17:18.660
could you just invoke?
00:17:18.660 --> 00:17:20.510
>> Yeah, we could but
there's no IntelliSense
00:17:20.510 --> 00:17:22.980
in F# Interactive. So I
prefer to do it here.
00:17:22.980 --> 00:17:23.760
>> Sure, make sense.
00:17:23.760 --> 00:17:26.895
>> Cool. So I'll send that
over and there we go.
00:17:26.895 --> 00:17:29.820
So this is actually, the
screens all blown out for
00:17:29.820 --> 00:17:31.460
the sake of the video but
00:17:31.460 --> 00:17:33.355
normally screens are
not quite like this.
00:17:33.355 --> 00:17:34.125
>> Sure.
00:17:34.125 --> 00:17:35.610
>> One of the things
that people will
00:17:35.610 --> 00:17:36.790
do with Interactive programming
00:17:36.790 --> 00:17:39.365
especially when they
want to learn in API is,
00:17:39.365 --> 00:17:40.650
they will write
some code in here,
00:17:40.650 --> 00:17:42.950
get the full-fidelity
editor and then you can
00:17:42.950 --> 00:17:44.520
hit Alt Enter and that
will just go ahead
00:17:44.520 --> 00:17:48.350
and execute whatever you're
doing in F# Interactive
00:17:48.350 --> 00:17:50.120
and you can see the results
as an output pane.
00:17:50.120 --> 00:17:50.320
>> Got it.
00:17:50.320 --> 00:17:51.975
>> Now, indeed, I could do that,
00:17:51.975 --> 00:17:52.580
I could go nameable.GetName(),
00:17:52.580 --> 00:17:58.995
but it's a little nicer
to do in the editor.
00:17:58.995 --> 00:18:02.400
Another cool thing that you
can have when you're scripting
00:18:02.400 --> 00:18:05.330
with F# is scripting
is sort of like
00:18:05.330 --> 00:18:08.195
this ad hoc sort of like.
This is just an F# script,
00:18:08.195 --> 00:18:10.200
what it actually does
is when you send it
00:18:10.200 --> 00:18:13.565
to F# Interactive, it basically
produces a script file
00:18:13.565 --> 00:18:16.105
in there that's sort of
logically what's going on.
00:18:16.105 --> 00:18:16.550
>> Right.
00:18:16.550 --> 00:18:19.500
>> But this script
isn't like the same
00:18:19.500 --> 00:18:22.670
as like a file that's
existing inside of a project,
00:18:22.670 --> 00:18:24.605
it's a bit more free I guess.
00:18:24.605 --> 00:18:27.575
>> Sure. It's like the syntax
a little bit looser.
00:18:27.575 --> 00:18:29.230
>> Yeah. Well, no the syntax is
00:18:29.230 --> 00:18:30.760
still sort of the same
but like what you
00:18:30.760 --> 00:18:32.900
reference and sort of
the contexts that exists
00:18:32.900 --> 00:18:35.110
in is there's a lot
more free there.
00:18:35.110 --> 00:18:37.090
So what you can do
is you can actually
00:18:37.090 --> 00:18:39.920
load additional files such
as external script files.
00:18:39.920 --> 00:18:42.950
So notice that I just
typed string there
00:18:42.950 --> 00:18:44.670
and all of a sudden I have access
00:18:44.670 --> 00:18:47.740
to stuff that's on my machine.
I can actually crawl the-.
00:18:47.740 --> 00:18:49.550
>> The file system.
00:18:49.550 --> 00:18:51.710
>> Yeah. I can crawl the file
system with IntelliSense so,
00:18:51.710 --> 00:18:53.040
like I don't think I have
00:18:53.040 --> 00:18:57.410
any other script files
released right here.
00:18:57.410 --> 00:19:00.440
I can maybe find some if I
was potentially curious.
00:19:00.440 --> 00:19:01.430
But what that will do
00:19:01.430 --> 00:19:03.270
is once it's loaded,
it effectively says.
00:19:03.270 --> 00:19:06.940
Okay, when F# Interactive
executes this script,
00:19:06.940 --> 00:19:09.145
it will go and look at
the low directive and then say.
00:19:09.145 --> 00:19:10.770
"Oh, there's another script
in there let's go
00:19:10.770 --> 00:19:12.540
ahead and execute that as well".
00:19:12.540 --> 00:19:16.560
So if you define
some types in one script,
00:19:16.560 --> 00:19:18.605
you can actually use
those types inside of this.
00:19:18.605 --> 00:19:18.850
>> Got it.
00:19:18.850 --> 00:19:19.970
>> So, it's sort of
like a whole mode of
00:19:19.970 --> 00:19:22.130
programming that you can
do inside a Visual Studio,
00:19:22.130 --> 00:19:23.865
you don't need VS 4.0 obviously.
00:19:23.865 --> 00:19:25.930
You can do it there
and so it's really,
00:19:25.930 --> 00:19:27.985
really nice for
just API exploration and
00:19:27.985 --> 00:19:31.070
kind of scripting out.
00:19:31.070 --> 00:19:32.820
Like how you would use
a part of a system
00:19:32.820 --> 00:19:34.620
that you're working in
before you do it for real.
00:19:34.620 --> 00:19:36.100
>> Sure. This is what you said
00:19:36.100 --> 00:19:37.060
is the main use case for us.
00:19:37.060 --> 00:19:38.490
It's mainly for prototyping
00:19:38.490 --> 00:19:39.820
kind of just trying
things out before.
00:19:39.820 --> 00:19:42.305
>> That's definitely one
of the main use cases,
00:19:42.305 --> 00:19:44.180
I would say another use
case especially one
00:19:44.180 --> 00:19:46.405
that's growing right now
is machine learning.
00:19:46.405 --> 00:19:47.890
Because in machine
learning you totally
00:19:47.890 --> 00:19:49.190
want to be in that
scripting environment,
00:19:49.190 --> 00:19:50.520
you want to just
execute some codes,
00:19:50.520 --> 00:19:51.710
see what it looks like, go back,
00:19:51.710 --> 00:19:52.960
change things
a little bit, like you're
00:19:52.960 --> 00:19:54.640
not building
a running application.
00:19:54.640 --> 00:19:55.230
>> Sure.
00:19:55.230 --> 00:19:56.870
>> So that interactivity model is
00:19:56.870 --> 00:19:58.260
really important for that and so
00:19:58.260 --> 00:19:59.540
this is something that
we're actually going to be
00:19:59.540 --> 00:20:01.000
investing in more moving forward.
00:20:01.000 --> 00:20:02.790
Because machine learning
is becoming more
00:20:02.790 --> 00:20:04.755
and more important and
F# is something that,
00:20:04.755 --> 00:20:06.100
like there's actually quite a few
00:20:06.100 --> 00:20:07.420
machine learning specialists
00:20:07.420 --> 00:20:09.090
in F# that have been
00:20:09.090 --> 00:20:11.295
wanting more advanced tools
in this sort of space.
00:20:11.295 --> 00:20:12.210
>> That makes sense.
00:20:12.210 --> 00:20:12.470
>> Yeah.
00:20:12.470 --> 00:20:13.620
There should be
some really cool stuff
00:20:13.620 --> 00:20:14.770
coming down the line there.
00:20:14.770 --> 00:20:18.220
But a few other things
that are cool.
00:20:18.220 --> 00:20:20.035
You may have noticed,
00:20:20.035 --> 00:20:22.590
let's see if I got
this right here.
00:20:22.590 --> 00:20:25.355
So you may have noticed that
if I hover over something,
00:20:25.355 --> 00:20:27.570
yeah I get the colors but
there's some stuff that's
00:20:27.570 --> 00:20:29.950
kind of underlined.
That's kind of weird.
00:20:29.950 --> 00:20:32.315
You normally don't see
that if you are in C#,
00:20:32.315 --> 00:20:34.160
well that's because you
can actually click on it,
00:20:34.160 --> 00:20:35.310
and it will go to definition.
00:20:35.310 --> 00:20:41.020
So F# toolsets are
sometimes a bit more.
00:20:42.300 --> 00:20:46.560
They can be a bit more rich
with information than C#
00:20:46.560 --> 00:20:49.300
cell tooltips including
the ability to navigate,
00:20:49.300 --> 00:20:51.775
which is cool. So, I can go there
00:20:51.775 --> 00:20:54.130
and there's this
markdown paragraph type.
00:20:54.130 --> 00:20:56.535
Whoa, it's a big one because
I blew up the font here.
00:20:56.535 --> 00:20:59.550
>> Sure. But, are they
those things with underlines,
00:20:59.550 --> 00:21:01.360
I can click on them
and go to this one.
00:21:01.360 --> 00:21:03.910
>> Exactly. I can go to this
thing called MarkdownSpans,
00:21:03.910 --> 00:21:05.345
see what that looks like.
00:21:05.345 --> 00:21:08.470
Similarly, you can F12,
00:21:08.470 --> 00:21:09.700
go to definition like that.
00:21:09.700 --> 00:21:11.440
Another one that
you can do is you
00:21:11.440 --> 00:21:13.200
can do Control click,
go to definition.
00:21:13.200 --> 00:21:14.820
So, now turned into
00:21:14.820 --> 00:21:16.090
a hyperlink and then I can
00:21:16.090 --> 00:21:18.045
click on that and that
will do the same thing.
00:21:18.045 --> 00:21:20.190
You can also just to round out
00:21:20.190 --> 00:21:22.155
all the different ways
you can go to definition,
00:21:22.155 --> 00:21:23.655
is you pick a definition.
00:21:23.655 --> 00:21:27.140
So, whichever one you
prefer, using the tooltips,
00:21:27.140 --> 00:21:29.235
invoking F12, invoking Alt-F12,
00:21:29.235 --> 00:21:30.400
or Control clicking, you can
00:21:30.400 --> 00:21:32.045
basically do at all
which is pretty sweet.
00:21:32.045 --> 00:21:32.505
>> Nice.
00:21:32.505 --> 00:21:36.685
>> Yeah. Then as you
probably noticed,
00:21:36.685 --> 00:21:39.265
either in this video or
certainly other videos
00:21:39.265 --> 00:21:42.485
is there's just autocompletion
as you're typing.
00:21:42.485 --> 00:21:43.990
So I type name and I get
00:21:43.990 --> 00:21:45.965
nameable right off the bat there.
00:21:45.965 --> 00:21:46.705
>> Great.
00:21:46.705 --> 00:21:48.960
>> Nothing too fancy
to talk about there,
00:21:48.960 --> 00:21:51.015
just you get completion
as you type.
00:21:51.015 --> 00:21:55.265
There's actually an option
to turn it on here.
00:21:55.265 --> 00:21:59.210
There's a few more options
that are interesting.
00:21:59.250 --> 00:22:02.540
So if we go to IntelliSense,
I have this turned off here,
00:22:02.540 --> 00:22:04.920
but this is show symbols
and unopened namespaces.
00:22:04.920 --> 00:22:06.465
So if I turn this on-
00:22:06.465 --> 00:22:07.010
>> What does that do?
00:22:07.010 --> 00:22:11.410
>> -I could go let d equals
dates, and all of a sudden,
00:22:11.410 --> 00:22:16.890
I got all these things that
are from other namespaces
00:22:16.890 --> 00:22:18.270
that I haven't
actually opened yet.
00:22:18.270 --> 00:22:20.900
So I've DateTime. I have not
opened the system namespace.
00:22:20.900 --> 00:22:23.330
So when I hit that up at the top,
00:22:23.330 --> 00:22:25.950
this actually stuck the
system namespace up there.
00:22:25.950 --> 00:22:26.510
>> Nice.
00:22:26.510 --> 00:22:28.360
>> Yeah. It's
a pretty neat feature.
00:22:28.360 --> 00:22:31.690
I have it turned off
because I usually prefer
00:22:31.690 --> 00:22:35.070
to not have too much of that
stuff in my completion list,
00:22:35.070 --> 00:22:36.470
but it's something that if you're
00:22:36.470 --> 00:22:38.260
the kind of person
who likes that stuff,
00:22:38.260 --> 00:22:40.180
you can absolutely
configure it that way.
00:22:40.180 --> 00:22:42.210
So you'll notice now I deleted
00:22:42.210 --> 00:22:45.860
the system namespace declaration
and that's gone.
00:22:45.860 --> 00:22:48.185
Well, I get another light bulb
and it says, "Hey,
00:22:48.185 --> 00:22:50.090
would you like to
open system or do you
00:22:50.090 --> 00:22:52.140
like to make it be
System.datetime."
00:22:52.140 --> 00:22:53.645
You can have that option there.
00:22:53.645 --> 00:22:55.460
So I'm going to have
it be System.datetime
00:22:55.460 --> 00:22:58.610
and then I'll go inside here,
00:22:58.610 --> 00:23:03.385
and I will go under
Code Fixes, simplify names.
00:23:03.385 --> 00:23:05.440
So if I go simplify
name analysis,
00:23:05.440 --> 00:23:06.880
we actually have this one
turned off because
00:23:06.880 --> 00:23:09.845
it can be rather expensive.
00:23:09.845 --> 00:23:11.260
I think it's trying to go through
00:23:11.260 --> 00:23:12.600
the whole project right now.
00:23:12.600 --> 00:23:14.940
So this is something that
some people like to have on,
00:23:14.940 --> 00:23:16.580
but what I would
normally do is allow you
00:23:16.580 --> 00:23:19.080
to remove the qualification.
00:23:19.080 --> 00:23:19.525
>> Okay.
00:23:19.525 --> 00:23:21.313
>> I use the select
off by default,
00:23:21.313 --> 00:23:22.330
I usually do keep it off
00:23:22.330 --> 00:23:23.710
because it can be
rather expensive.
00:23:23.710 --> 00:23:26.030
But if you want to do
that, you can run that.
00:23:26.030 --> 00:23:27.685
>> What was that one call
again, originally?
00:23:27.685 --> 00:23:28.795
>> Simplify names.
00:23:28.795 --> 00:23:30.815
>> Simplify names and that's
what inside of Code Fixes.
00:23:30.815 --> 00:23:31.760
>> Yeah. Inside of Code Fixes.
00:23:31.760 --> 00:23:33.940
So we have a few of these that
are turned on by default.
00:23:33.940 --> 00:23:35.600
If you don't like the light bulbs
00:23:35.600 --> 00:23:37.050
coming after you for
any reason or another,
00:23:37.050 --> 00:23:39.055
you can always just go
ahead and turn them off.
00:23:39.055 --> 00:23:39.820
>> Got it.
00:23:39.820 --> 00:23:43.170
>> It's just sweet. Then,
we have another one.
00:23:43.170 --> 00:23:44.930
This is more of
an experimental features,
00:23:44.930 --> 00:23:47.605
so it's pretty sweet.
00:23:47.605 --> 00:23:50.285
Let's see. We'll use
colors and annotations.
00:23:50.285 --> 00:23:55.090
Okay. So let me create
a new script file here and I
00:23:55.090 --> 00:24:02.285
will copy and paste all
of this over into here,
00:24:02.285 --> 00:24:04.040
and we should get some stuff.
00:24:04.040 --> 00:24:06.090
Whoa, the font's a little big.
00:24:06.090 --> 00:24:08.060
I forgot to turn the font down.
00:24:08.060 --> 00:24:10.745
>> That's why. So what is
this, what is this do?
00:24:10.745 --> 00:24:13.250
>> Actually here, I
really need to adjust
00:24:13.250 --> 00:24:14.965
the font here because
this looks ridiculous.
00:24:14.965 --> 00:24:16.260
>> Sure, exactly.
00:24:16.260 --> 00:24:20.120
>> CodeLens. Okay.
Let's make that.
00:24:20.120 --> 00:24:22.855
Well, so you have
it at 150 percent.
00:24:22.855 --> 00:24:24.130
Is that what you
want it turned out?
00:24:24.130 --> 00:24:29.050
>> Yeah. That could be
it, maybe. I don't know.
00:24:29.050 --> 00:24:30.940
>> It's a specific setting.
00:24:30.940 --> 00:24:31.825
>> Okay.
00:24:31.825 --> 00:24:34.940
>> Yeah. So I'd have to
change that somewhere.
00:24:34.940 --> 00:24:37.170
But what's important here is,
00:24:37.170 --> 00:24:38.750
so you see these little things
00:24:38.750 --> 00:24:40.350
that look like comments
up at the top here.
00:24:40.350 --> 00:24:42.655
Well, this is actually
a fake comment.
00:24:42.655 --> 00:24:46.500
But this is actually
using some type
00:24:46.500 --> 00:24:47.660
inference in this case.
00:24:47.660 --> 00:24:59.170
So I can go let's fx is
equal to xs List.sum.
00:25:00.890 --> 00:25:03.900
Let's start sum right.
00:25:03.900 --> 00:25:15.785
Let's go List.sumBy such
is greater than three.
00:25:15.785 --> 00:25:21.055
Is that it? Yeah. No,
this not support,
00:25:21.055 --> 00:25:24.170
says bool does not support.
00:25:25.950 --> 00:25:29.110
Well, I'm talking. So, I'm just
00:25:29.110 --> 00:25:31.960
going to do a quick
other thing here,
00:25:31.960 --> 00:25:37.250
List.filter such that x.
00:25:37.890 --> 00:25:41.800
Okay, cool. So, that produces
the odds in this case.
00:25:41.800 --> 00:25:42.475
>> Okay.
00:25:42.475 --> 00:25:44.350
>> I had a brain fart there.
00:25:44.350 --> 00:25:46.620
But so, I've just
done this one so many
00:25:46.620 --> 00:25:49.110
times that it's like I don't
even think as I type it.
00:25:49.110 --> 00:25:51.440
But still, you'll notice
that something popped
00:25:51.440 --> 00:25:53.620
up here where it says int list
and an arrow int list.
00:25:53.620 --> 00:25:55.490
This is actually, if
you hover over F,
00:25:55.490 --> 00:25:57.680
it shows the same thing.
00:25:57.690 --> 00:26:01.750
But, this is something that
exists in Visual Studio Code.
00:26:01.750 --> 00:26:03.850
It's at a higher fidelity
in Visual Studio Code,
00:26:03.850 --> 00:26:05.520
which is why this is off
by default right now.
00:26:05.520 --> 00:26:07.430
It's behind a little thing
that says experimental.
00:26:07.430 --> 00:26:07.840
>> Yeah.
00:26:07.840 --> 00:26:08.930
>> But this is really helpful
00:26:08.930 --> 00:26:10.790
for especially
newcomers if they're
00:26:10.790 --> 00:26:12.330
typing code and they
want to see like
00:26:12.330 --> 00:26:13.965
what the types of
things actually are.
00:26:13.965 --> 00:26:14.470
>> Sure.
00:26:14.470 --> 00:26:15.380
>> So this is something
00:26:15.380 --> 00:26:16.670
that we're hoping
to flesh out over
00:26:16.670 --> 00:26:21.265
time and then eventually
turned on by defaults.
00:26:21.265 --> 00:26:22.990
Maybe we'll see it,
00:26:22.990 --> 00:26:24.270
something we're going to
experiment with getting
00:26:24.270 --> 00:26:25.910
feedback on sort of do
that sort of thing.
00:26:25.910 --> 00:26:27.840
But this, again,
is also something
00:26:27.840 --> 00:26:30.280
that may be very helpful
for data science work codes
00:26:30.280 --> 00:26:31.690
because you may have a lot
of people who are new
00:26:31.690 --> 00:26:33.150
to F# and functional programming
00:26:33.150 --> 00:26:34.320
but want to reap the benefits
00:26:34.320 --> 00:26:36.810
of FP strong types
that sort of stuff.
00:26:36.810 --> 00:26:37.370
>> Sure.
00:26:37.370 --> 00:26:40.660
>> Little tools like
this can help that out.
00:26:40.660 --> 00:26:42.660
>> So in terms of giving feedback
00:26:42.660 --> 00:26:44.100
because you just
mentioned you want people
00:26:44.100 --> 00:26:46.275
to try out somebody's
experimental features.
00:26:46.275 --> 00:26:48.123
Where's the best place
for us to go to
00:26:48.123 --> 00:26:50.420
give you feedback on
some of these tools
00:26:50.420 --> 00:26:51.440
and some of the things that are
00:26:51.440 --> 00:26:53.750
happening particularly
with F# tool?
00:26:53.750 --> 00:26:54.840
>> Yeah, absolutely.
00:26:54.840 --> 00:26:57.300
So there's two primary ways
00:26:57.300 --> 00:27:00.100
to submit feedback and
bugs honestly as well,
00:27:00.100 --> 00:27:01.570
if you run into something
that you think is a bug,
00:27:01.570 --> 00:27:02.995
it's a good idea to
always submit it.
00:27:02.995 --> 00:27:03.280
>> Yeah.
00:27:03.280 --> 00:27:05.670
>> Within Visual Studio,
there's the send feedback tool
00:27:05.670 --> 00:27:08.110
with report a problem and
this thing will pop up
00:27:08.110 --> 00:27:10.120
and loads a whole bunch
of different stuff
00:27:10.120 --> 00:27:12.190
you can optionally collects
00:27:12.190 --> 00:27:15.470
all sorts of
diagnostic information.
00:27:15.470 --> 00:27:17.120
If you want to send it,
00:27:17.120 --> 00:27:18.180
if you search for something,
00:27:18.180 --> 00:27:20.630
it brings up
existing issues to see
00:27:20.630 --> 00:27:23.570
if the thing that you're
reporting is also like that.
00:27:23.570 --> 00:27:25.640
Looks like I'm not signed
in, so I needed to do that.
00:27:25.640 --> 00:27:26.155
>> Sure.
00:27:26.155 --> 00:27:27.300
>> Typical for me.
00:27:27.300 --> 00:27:28.725
>> But it's all right in editor.
00:27:28.725 --> 00:27:30.000
That doesn't goes anywhere else.
00:27:30.000 --> 00:27:32.680
>> That's one option and
then the other option is,
00:27:32.680 --> 00:27:38.160
if you go to Microsoft Visual F#,
00:27:38.160 --> 00:27:39.720
so we have a repository here.
00:27:39.720 --> 00:27:41.545
This is where all the stuff
is open source.
00:27:41.545 --> 00:27:42.970
So you just go to
the issues link,
00:27:42.970 --> 00:27:44.000
go and create a new issue.
00:27:44.000 --> 00:27:45.980
You can get feedback.
You can report a bug.
00:27:45.980 --> 00:27:48.740
You can maybe suggests that
something should be done.
00:27:48.740 --> 00:27:50.440
So if you want to
look at here and you
00:27:50.440 --> 00:27:54.665
go feature request,
something like that.
00:27:54.665 --> 00:27:57.110
There's all sorts of feature
request that can come here.
00:27:57.110 --> 00:27:59.850
So you could at one of
those maybe say, "Oh,
00:27:59.850 --> 00:28:02.620
I'd be interested in
implementing that."
00:28:02.620 --> 00:28:03.360
>> Okay, cool.
00:28:03.360 --> 00:28:05.670
>> So, that's how
feedback can go.
00:28:05.670 --> 00:28:07.970
So if we turn something on
by default and you say,
00:28:07.970 --> 00:28:09.360
"Man, I really don't like that."
00:28:09.360 --> 00:28:11.720
Then you can come on here
and explain to us why
00:28:11.720 --> 00:28:13.370
and we can have
a discussion about it
00:28:13.370 --> 00:28:15.360
and maybe see if there's a way
00:28:15.360 --> 00:28:17.560
to make the options
more discoverable,
00:28:17.560 --> 00:28:19.720
and maybe if there's a way,
maybe we decide, "Okay, yeah.
00:28:19.720 --> 00:28:22.930
Maybe we should actually turn
this one off by default."
00:28:22.930 --> 00:28:25.360
We'd like to have
these conversations with people.
00:28:25.360 --> 00:28:26.350
>> Sure, that sounds pretty good.
00:28:26.350 --> 00:28:28.810
So our call to
action is make sure
00:28:28.810 --> 00:28:32.385
you go and select the
.NET desktop workload.
00:28:32.385 --> 00:28:33.950
Make sure we hit that checkbox,
00:28:33.950 --> 00:28:36.240
so we get the Visual F# tools.
00:28:36.240 --> 00:28:37.860
>> ASP.NET workload as well.
00:28:37.860 --> 00:28:39.610
>> Inside of the ASP.NET
workload as well and and
00:28:39.610 --> 00:28:42.080
also to make sure that we
send some feedback back.
00:28:42.080 --> 00:28:44.510
Whether it's through GitHub
or through that send
00:28:44.510 --> 00:28:47.180
feedback inside of
Visual Studio. That's it.
00:28:47.180 --> 00:28:47.770
>> Absolutely.
00:28:47.770 --> 00:28:48.880
>> Awesome. Thank you
so much for coming,
00:28:48.880 --> 00:28:49.740
I really appreciate it.
00:28:49.740 --> 00:28:50.555
>> Yeah. Welcome.
00:28:50.555 --> 00:28:51.870
>> This has been
another episode of
00:28:51.870 --> 00:28:53.920
the ON.NET show and
we had Pope talking
00:28:53.920 --> 00:28:55.310
to us about some
of the new tooling
00:28:55.310 --> 00:28:57.890
inside of Visual Studio for F#.