Topics

Featured in Development

Peter Alvaro talks about the reasons one should engage in language design and why many of us would (or should) do something so perverse as to design a language that no one will ever use. He shares some of the extreme and sometimes obnoxious opinions that guided his design process.

Featured in AI, ML & Data Engineering

Today on The InfoQ Podcast, Wes talks with Katharine Jarmul about privacy and fairness in machine learning algorithms. Jarul discusses what’s meant by Ethical Machine Learning and some things to consider when working towards achieving fairness. Jarmul is the co-founder at KIProtect a machine learning security and privacy firm based in Germany and is one of the three keynote speakers at QCon.ai.

Featured in Culture & Methods

Organizations struggle to scale their agility. While every organization is different, common patterns explain the major challenges that most organizations face: organizational design, trying to copy others, “one-size-fits-all” scaling, scaling in siloes, and neglecting engineering practices. This article explains why, what to do about it, and how the three leading scaling frameworks compare.

Wrapping Stored Procedures in .NET Languages

Creating wrapper functions for pre-existing stored procedures is surprisingly difficult in .NET. Stored procedures have certain calling conventions that aren’t generally used in the .NET Framework. These include:

Pass by Reference Parameters

Output Parameters

Optional Parameters with default values

All parameters are nullable

Until recently, full mappings were not possible. C# doesn’t currently support optional parameters, making placeholders for missing parameters necessary. VB could handle optional parameters, but not if those parameters were also nullable. For example, you cannot write:

This becomes a real concern when call search-style stored procedures that then to have numerous optional parameters. With C# 4 and VB 10, the last of these holes have been addressed. C# now supports optional values and both languages can use optional types in conjunction with nullable structures.

Feature

C#

Mapping

VB

Mapping

F#

Mapping

Pass by Reference

1

ref type [param]

7

ByRef [param] As [type]

4

[param] : [type] byref

Output

1

out type [param]

7

ByRef [param] As [type]

4

[param] : [type] byref

Optional Strings

4

string param = [default]

7

Optional [param] As String = [default]

N/A

4

Normal functions do not support optional parameters.

Method functions use: ?[param] : [type]

Optional (other)

4

[type] param = [default]

7

Optional param As [type] = [default]

Nullable Strings

1

string param

7

param as String

4

[param] : string

[param] : string option

Nullable (other)

2

[type]? param

8

param As Nullable(of

[type])

4

[param] : Nullable<[type]>

[param] : [type] option

9

param as [type]?

Optional Nullable (other)

4

[type]? param = [default]

10

Optional param As [type]? = [default]

4

?[param] : Nullable<[type]>

?[param] : [type] option

It should be noted that while F# does support returning multiple values, the support is very limited. There is no way to update more than one arbitrary mutable value without using the byref syntax.