F# 继承类中的缩进规则?
我对F#编译器(通过Ionide)关于缩进规则有点困惑 以下是触发警告的代码片段:F# 继承类中的缩进规则?,f#,F#,我对F#编译器(通过Ionide)关于缩进规则有点困惑 以下是触发警告的代码片段: type MyGame () as this = inherit Game () let graphics = new GraphicsDeviceManager (this) let mutable spriteBatch = null let mutable state = { Board = Map.empty Selection =
type MyGame () as this =
inherit Game ()
let graphics = new GraphicsDeviceManager (this)
let mutable spriteBatch = null
let mutable state =
{
Board = Map.empty
Selection = List.empty
}
do
this.IsMouseVisible <- true
// ...
键入MyGame(),如下所示=
继承游戏()
let graphics=新的GraphicsDeviceManager(此)
设可变spriteBatch=null
让变态=
{
Board=Map.empty
Selection=List.empty
}
做
这是因为你的inherit Game()
行没有下一行那么缩进。更改缩进,警告就会消失:
type MyGame () as this =
inherit Game ()
let graphics = new GraphicsDeviceManager (this)
let mutable spriteBatch = null
let mutable state =
{
Board = Map.empty
Selection = List.empty
}
do
this.IsMouseVisible <- true
// ...
键入MyGame(),如下所示=
继承游戏()
let graphics=新的GraphicsDeviceManager(此)
设可变spriteBatch=null
让变态=
{
Board=Map.empty
Selection=List.empty
}
做
这张照片是看得见的
type MyGame () as this =
inherit Game ()
let graphics = new GraphicsDeviceManager (this)
let mutable spriteBatch = null
let mutable state =
{
Board = Map.empty
Selection = List.empty
}
do
this.IsMouseVisible <- true
// ...