Re[5]: XML комментарии
От: MxKazan Португалия  
Дата: 24.10.08 12:50
Оценка:
Здравствуйте, Mr.Cat, Вы писали:

MC>Здравствуйте, MxKazan, Вы писали:

MK>>С другой стороны, тоже не выход — комменты по аргументам захламят описание сигнатуры — будет даже хуже.

MC>Чтобы не быть голословным — вот пример.

MC>
MC>-- | This is the documentation for the 'f' function
MC>f  :: Int      -- ^ The 'Int' argument
   ->> Float    -- ^ The 'Float' argument
   ->> IO ()    -- ^ The return value
MC>f = <тут уже определение функции>
MC>


MC>"--" — Это обычное начало однострочного комментария в хаскеле.

MC>"^" и "|"- Это оверхед от haddock'а (ну кроме необходимости размещать спецификацию функции на нескольких строках).

Более реальный вариант:

// Initializes a new instance of the Binding class that binds the indicated control property to the specified data member of the specified data source.
// Optionally enables formatting, propagates values to the data source based on the specified update setting, and sets the property to the specified value
// when a DBNull is returned from the data source.
public Binding(
    string propertyName,    // The name of the control property to bind.
    Object dataSource,    // An Object representing the data source.
    string dataMember,    // The property or list to bind to.
    bool formattingEnabled, // true to format the displayed data; otherwise, false.
    Object nullValue    // The Object to be applied to the bound control property if the data source value is DBNull.
)


Не улавливаю, чем это лучше XML'а?
Как быть, если у меня будет длинный тип параметра и длинное имя.
Как быть, если я в описании функции захочу сослаться на параметр?
 
Подождите ...
Wait...
Пока на собственное сообщение не было ответов, его можно удалить.